diff --git a/src/Runner.Server/Controllers/ArtifactControllerV2.cs b/src/Runner.Server/Controllers/ArtifactControllerV2.cs index 4fef57cb2ec..0366a377761 100644 --- a/src/Runner.Server/Controllers/ArtifactControllerV2.cs +++ b/src/Runner.Server/Controllers/ArtifactControllerV2.cs @@ -35,12 +35,12 @@ public ArtifactControllerV2(SqLiteDb _context, IConfiguration configuration) : b } private string CreateSignature(int id) { - using(var rsa = RSA.Create(Startup.AccessTokenParameter)) + using var rsa = RSA.Create(Startup.AccessTokenParameter); return Base64UrlEncoder.Encode(rsa.SignData(Encoding.UTF8.GetBytes(id.ToString()), HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1)); } private bool VerifySignature(int id, string sig) { - using(var rsa = RSA.Create(Startup.AccessTokenParameter)) + using var rsa = RSA.Create(Startup.AccessTokenParameter); return rsa.VerifyData(Encoding.UTF8.GetBytes(id.ToString()), Base64UrlEncoder.DecodeBytes(sig), HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); } @@ -76,7 +76,7 @@ public async Task UploadArtifact(int id, string sig, string comp if(string.IsNullOrEmpty(sig) || !VerifySignature(id, sig)) { return NotFound(); } - if(comp == "block" || comp == "appendBlock") { + if(comp == "block" || comp == "appendBlock" || comp == null) { var record = await _context.ArtifactRecords.FindAsync(id); var _targetFilePath = Path.Combine(GitHub.Runner.Sdk.GharunUtil.GetLocalStorage(), "artifacts"); using(var targetStream = new FileStream(Path.Combine(_targetFilePath, record.StoreName), FileMode.OpenOrCreate | FileMode.Append, FileAccess.Write, FileShare.Write)) { @@ -171,36 +171,5 @@ public async Task DeleteArtifact([FromBody, Protobuf] Github.Acti }; return new OkObjectResult(formatter.Format(resp)); } - - - public class ProtobufBinder : IModelBinder - { - public async Task BindModelAsync(ModelBindingContext bindingContext) - { - if (!bindingContext.HttpContext.Request.HasJsonContentType()) - { - throw new BadHttpRequestException( - "Request content type was not a recognized JSON content type.", - StatusCodes.Status415UnsupportedMediaType); - } - - using var sr = new StreamReader(bindingContext.HttpContext.Request.Body); - var str = await sr.ReadToEndAsync(); - - var valueType = bindingContext.ModelType; - var parser = new JsonParser(JsonParser.Settings.Default.WithIgnoreUnknownFields(true)); - - var descriptor = (MessageDescriptor)bindingContext.ModelType.GetProperty("Descriptor", BindingFlags.Public | BindingFlags.Static).GetValue(null, null); - var obj = parser.Parse(str, descriptor); - - bindingContext.Result = ModelBindingResult.Success(obj); - } - } - - public class ProtobufAttribute : ModelBinderAttribute { - public ProtobufAttribute() : base(typeof(ProtobufBinder)) { - - } - } } } diff --git a/src/Runner.Server/Controllers/CacheControllerV2.cs b/src/Runner.Server/Controllers/CacheControllerV2.cs new file mode 100644 index 00000000000..503c753dc4b --- /dev/null +++ b/src/Runner.Server/Controllers/CacheControllerV2.cs @@ -0,0 +1,131 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.Configuration; +using Google.Protobuf; +using System; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc.ModelBinding; +using Microsoft.AspNetCore.Http; +using System.IO; +using System.Reflection; +using Google.Protobuf.Reflection; +using Microsoft.AspNetCore.Http.Extensions; +using Runner.Server.Models; +using System.Linq; +using Microsoft.EntityFrameworkCore; +using GitHub.Actions.Pipelines.WebApi; +using System.Security.Cryptography; +using Microsoft.IdentityModel.Tokens; +using System.Text; + +namespace Runner.Server.Controllers +{ + + [ApiController] + [Route("twirp/github.actions.results.api.v1.CacheService")] + [Authorize(AuthenticationSchemes = "Bearer", Policy = "AgentJob")] + public class CacheControllerV2 : VssControllerBase{ + private readonly SqLiteDb _context; + private readonly JsonFormatter formatter; + + public CacheControllerV2(SqLiteDb _context, IConfiguration configuration) : base(configuration) + { + this._context = _context; + formatter = new JsonFormatter(JsonFormatter.Settings.Default.WithIndentation().WithPreserveProtoFieldNames(true).WithFormatDefaultValues(false)); + } + + private string CreateSignature(int id) { + using var rsa = RSA.Create(Startup.AccessTokenParameter); + return Base64UrlEncoder.Encode(rsa.SignData(Encoding.UTF8.GetBytes(id.ToString()), HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1)); + } + + private bool VerifySignature(int id, string sig) { + using var rsa = RSA.Create(Startup.AccessTokenParameter); + return rsa.VerifyData(Encoding.UTF8.GetBytes(id.ToString()), Base64UrlEncoder.DecodeBytes(sig), HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); + } + + [HttpPost("CreateCacheEntry")] + public async Task CreateCacheEntry([FromBody, Protobuf] Github.Actions.Results.Api.V1.CreateCacheEntryRequest body) { + var filename = Path.GetRandomFileName(); + var reference = User.FindFirst("ref")?.Value ?? "refs/heads/main"; + var repository = User.FindFirst("repository")?.Value ?? "Unknown/Unknown"; + var record = new CacheRecord() { Key = body.Key, LastUpdated = DateTime.Now, Ref = reference, Version = body.Version, Storage = filename, Repo = repository }; + _context.Caches.Add(record); + await _context.SaveChangesAsync(); + var resp = new Github.Actions.Results.Api.V1.CreateCacheEntryResponse + { + Ok = true, + SignedUploadUrl = new Uri(new Uri(ServerUrl), $"twirp/github.actions.results.api.v1.CacheService/UploadCache?id={record.Id}&sig={CreateSignature(record.Id)}").ToString() + }; + return formatter.Format(resp); + } + + [HttpPut("UploadCache")] + [AllowAnonymous] + public async Task UploadCache(int id, string sig, string comp = null, bool seal = false) { + if(string.IsNullOrEmpty(sig) || !VerifySignature(id, sig)) { + return NotFound(); + } + if(comp == "block" || comp == "appendBlock" || comp == null) { + var record = await _context.Caches.FindAsync(id); + var _targetFilePath = Path.Combine(GitHub.Runner.Sdk.GharunUtil.GetLocalStorage(), "cache"); + Directory.CreateDirectory(_targetFilePath); + using(var targetStream = new FileStream(Path.Combine(_targetFilePath, record.Storage), FileMode.OpenOrCreate | FileMode.Append, FileAccess.Write, FileShare.Write)) { + await Request.Body.CopyToAsync(targetStream); + } + return Created(HttpContext.Request.GetEncodedUrl(), null); + } + if(comp == "blocklist") { + return Created(HttpContext.Request.GetEncodedUrl(), null); + } + return Ok(); + } + + [HttpPost("FinalizeCacheEntryUpload")] + public string FinalizeCacheEntryUpload([FromBody, Protobuf] Github.Actions.Results.Api.V1.FinalizeCacheEntryUploadRequest body) { + var record = _context.Caches.First(c => c.Key == body.Key && c.Version == body.Version); + var resp = new Github.Actions.Results.Api.V1.FinalizeCacheEntryUploadResponse + { + Ok = true, + EntryId = record.Id + }; + return formatter.Format(resp); + } + + [HttpPost("GetCacheEntryDownloadURL")] + public string GetCacheEntryDownloadURL([FromBody, Protobuf] Github.Actions.Results.Api.V1.GetCacheEntryDownloadURLRequest body) { + var a = body.RestoreKeys.Prepend(body.Key).ToArray(); + var version = body.Version; + var defaultRef = User.FindFirst("defaultRef")?.Value ?? "refs/heads/main"; + var reference = User.FindFirst("ref")?.Value ?? "refs/heads/main"; + var repository = User.FindFirst("repository")?.Value ?? "Unknown/Unknown"; + foreach(var cref in reference != defaultRef ? new [] { reference, defaultRef } : new [] { reference }) { + foreach (var item in a) { + var record = (from rec in _context.Caches where rec.Repo.ToLower() == repository.ToLower() && rec.Ref == cref && rec.Key.ToLower() == item.ToLower() && (rec.Version == null || rec.Version == "" || rec.Version == version) orderby rec.LastUpdated descending select rec).FirstOrDefault() + ?? (from rec in _context.Caches where rec.Repo.ToLower() == repository.ToLower() && rec.Ref == cref && rec.Key.ToLower().StartsWith(item.ToLower()) && (rec.Version == null || rec.Version == "" || rec.Version == version) orderby rec.LastUpdated descending select rec).FirstOrDefault(); + if(record != null) { + var resp = new Github.Actions.Results.Api.V1.GetCacheEntryDownloadURLResponse + { + Ok = true, + MatchedKey = record.Key, + SignedDownloadUrl = new Uri(new Uri(ServerUrl), $"twirp/github.actions.results.api.v1.CacheService/DownloadCache?id={record.Id}&sig={CreateSignature(record.Id)}").ToString() + }; + return formatter.Format(resp); + } + } + } + return formatter.Format(new Github.Actions.Results.Api.V1.GetCacheEntryDownloadURLResponse { Ok = false }); + } + + [AllowAnonymous] + [HttpGet("DownloadCache")] + public IActionResult DownloadCache(int id, string sig) { + if(string.IsNullOrEmpty(sig) || !VerifySignature(id, sig)) { + return NotFound(); + } + var container = _context.Caches.Find(id); + var _targetFilePath = Path.Combine(GitHub.Runner.Sdk.GharunUtil.GetLocalStorage(), "cache"); + return new FileStreamResult(System.IO.File.OpenRead(Path.Combine(_targetFilePath, container.Storage)), "application/octet-stream") { EnableRangeProcessing = true }; + } + } +} diff --git a/src/Runner.Server/Controllers/MessageController.cs b/src/Runner.Server/Controllers/MessageController.cs index f591355a5fe..6b789be649c 100644 --- a/src/Runner.Server/Controllers/MessageController.cs +++ b/src/Runner.Server/Controllers/MessageController.cs @@ -5174,6 +5174,7 @@ private Func queueJob(GitHub.DistributedTask.ObjectTemplating.ITraceW variables.Add("DistributedTask.AllowRunnerContainerHooks", new VariableValue("true", false)); variables.Add("DistributedTask.DeprecateStepOutputCommands", new VariableValue("true", false)); variables.Add("DistributedTask.ForceGithubJavascriptActionsToNode16", new VariableValue("true", false)); // https://github.blog/changelog/2023-05-04-github-actions-all-actions-will-run-on-node16-instead-of-node12/ + variables.Add("actions_uses_cache_service_v2", new VariableValue("true", false)); // https://github.com/actions/toolkit/discussions/1890 // For actions/upload-artifact@v1, actions/download-artifact@v1 variables.Add(SdkConstants.Variables.Build.BuildId, new VariableValue(runid.ToString(), false)); variables.Add(SdkConstants.Variables.Build.BuildNumber, new VariableValue(runid.ToString(), false)); diff --git a/src/Runner.Server/Protobuf/Cache.cs b/src/Runner.Server/Protobuf/Cache.cs new file mode 100644 index 00000000000..c4f0fbd60c2 --- /dev/null +++ b/src/Runner.Server/Protobuf/Cache.cs @@ -0,0 +1,1711 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: cache.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Github.Actions.Results.Api.V1 { + + /// Holder for reflection information generated from cache.proto + public static partial class CacheReflection { + + #region Descriptor + /// File descriptor for cache.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static CacheReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CgtjYWNoZS5wcm90bxIdZ2l0aHViLmFjdGlvbnMucmVzdWx0cy5hcGkudjEa", + "FGNhY2hlX21ldGFkYXRhLnByb3RvInwKF0NyZWF0ZUNhY2hlRW50cnlSZXF1", + "ZXN0EkMKCG1ldGFkYXRhGAEgASgLMjEuZ2l0aHViLmFjdGlvbnMucmVzdWx0", + "cy5lbnRpdGllcy52MS5DYWNoZU1ldGFkYXRhEgsKA2tleRgCIAEoCRIPCgd2", + "ZXJzaW9uGAMgASgJIkEKGENyZWF0ZUNhY2hlRW50cnlSZXNwb25zZRIKCgJv", + "axgBIAEoCBIZChFzaWduZWRfdXBsb2FkX3VybBgCIAEoCSKYAQofRmluYWxp", + "emVDYWNoZUVudHJ5VXBsb2FkUmVxdWVzdBJDCghtZXRhZGF0YRgBIAEoCzIx", + "LmdpdGh1Yi5hY3Rpb25zLnJlc3VsdHMuZW50aXRpZXMudjEuQ2FjaGVNZXRh", + "ZGF0YRILCgNrZXkYAiABKAkSEgoKc2l6ZV9ieXRlcxgDIAEoAxIPCgd2ZXJz", + "aW9uGAQgASgJIkAKIEZpbmFsaXplQ2FjaGVFbnRyeVVwbG9hZFJlc3BvbnNl", + "EgoKAm9rGAEgASgIEhAKCGVudHJ5X2lkGAIgASgDIpoBCh9HZXRDYWNoZUVu", + "dHJ5RG93bmxvYWRVUkxSZXF1ZXN0EkMKCG1ldGFkYXRhGAEgASgLMjEuZ2l0", + "aHViLmFjdGlvbnMucmVzdWx0cy5lbnRpdGllcy52MS5DYWNoZU1ldGFkYXRh", + "EgsKA2tleRgCIAEoCRIUCgxyZXN0b3JlX2tleXMYAyADKAkSDwoHdmVyc2lv", + "bhgEIAEoCSJgCiBHZXRDYWNoZUVudHJ5RG93bmxvYWRVUkxSZXNwb25zZRIK", + "CgJvaxgBIAEoCBIbChNzaWduZWRfZG93bmxvYWRfdXJsGAIgASgJEhMKC21h", + "dGNoZWRfa2V5GAMgASgJYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Github.Actions.Results.Entities.V1.CacheMetadataReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Github.Actions.Results.Api.V1.CreateCacheEntryRequest), global::Github.Actions.Results.Api.V1.CreateCacheEntryRequest.Parser, new[]{ "Metadata", "Key", "Version" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Github.Actions.Results.Api.V1.CreateCacheEntryResponse), global::Github.Actions.Results.Api.V1.CreateCacheEntryResponse.Parser, new[]{ "Ok", "SignedUploadUrl" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Github.Actions.Results.Api.V1.FinalizeCacheEntryUploadRequest), global::Github.Actions.Results.Api.V1.FinalizeCacheEntryUploadRequest.Parser, new[]{ "Metadata", "Key", "SizeBytes", "Version" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Github.Actions.Results.Api.V1.FinalizeCacheEntryUploadResponse), global::Github.Actions.Results.Api.V1.FinalizeCacheEntryUploadResponse.Parser, new[]{ "Ok", "EntryId" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Github.Actions.Results.Api.V1.GetCacheEntryDownloadURLRequest), global::Github.Actions.Results.Api.V1.GetCacheEntryDownloadURLRequest.Parser, new[]{ "Metadata", "Key", "RestoreKeys", "Version" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Github.Actions.Results.Api.V1.GetCacheEntryDownloadURLResponse), global::Github.Actions.Results.Api.V1.GetCacheEntryDownloadURLResponse.Parser, new[]{ "Ok", "SignedDownloadUrl", "MatchedKey" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class CreateCacheEntryRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateCacheEntryRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Github.Actions.Results.Api.V1.CacheReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CreateCacheEntryRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CreateCacheEntryRequest(CreateCacheEntryRequest other) : this() { + metadata_ = other.metadata_ != null ? other.metadata_.Clone() : null; + key_ = other.key_; + version_ = other.version_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CreateCacheEntryRequest Clone() { + return new CreateCacheEntryRequest(this); + } + + /// Field number for the "metadata" field. + public const int MetadataFieldNumber = 1; + private global::Github.Actions.Results.Entities.V1.CacheMetadata metadata_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Github.Actions.Results.Entities.V1.CacheMetadata Metadata { + get { return metadata_; } + set { + metadata_ = value; + } + } + + /// Field number for the "key" field. + public const int KeyFieldNumber = 2; + private string key_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "version" field. + public const int VersionFieldNumber = 3; + private string version_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Version { + get { return version_; } + set { + version_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CreateCacheEntryRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CreateCacheEntryRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Metadata, other.Metadata)) return false; + if (Key != other.Key) return false; + if (Version != other.Version) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (metadata_ != null) hash ^= Metadata.GetHashCode(); + if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (Version.Length != 0) hash ^= Version.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (metadata_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Metadata); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Key); + } + if (Version.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Version); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (metadata_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Metadata); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Key); + } + if (Version.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Version); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (metadata_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Metadata); + } + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + } + if (Version.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Version); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CreateCacheEntryRequest other) { + if (other == null) { + return; + } + if (other.metadata_ != null) { + if (metadata_ == null) { + Metadata = new global::Github.Actions.Results.Entities.V1.CacheMetadata(); + } + Metadata.MergeFrom(other.Metadata); + } + if (other.Key.Length != 0) { + Key = other.Key; + } + if (other.Version.Length != 0) { + Version = other.Version; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (metadata_ == null) { + Metadata = new global::Github.Actions.Results.Entities.V1.CacheMetadata(); + } + input.ReadMessage(Metadata); + break; + } + case 18: { + Key = input.ReadString(); + break; + } + case 26: { + Version = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (metadata_ == null) { + Metadata = new global::Github.Actions.Results.Entities.V1.CacheMetadata(); + } + input.ReadMessage(Metadata); + break; + } + case 18: { + Key = input.ReadString(); + break; + } + case 26: { + Version = input.ReadString(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class CreateCacheEntryResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateCacheEntryResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Github.Actions.Results.Api.V1.CacheReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CreateCacheEntryResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CreateCacheEntryResponse(CreateCacheEntryResponse other) : this() { + ok_ = other.ok_; + signedUploadUrl_ = other.signedUploadUrl_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CreateCacheEntryResponse Clone() { + return new CreateCacheEntryResponse(this); + } + + /// Field number for the "ok" field. + public const int OkFieldNumber = 1; + private bool ok_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Ok { + get { return ok_; } + set { + ok_ = value; + } + } + + /// Field number for the "signed_upload_url" field. + public const int SignedUploadUrlFieldNumber = 2; + private string signedUploadUrl_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string SignedUploadUrl { + get { return signedUploadUrl_; } + set { + signedUploadUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CreateCacheEntryResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CreateCacheEntryResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Ok != other.Ok) return false; + if (SignedUploadUrl != other.SignedUploadUrl) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Ok != false) hash ^= Ok.GetHashCode(); + if (SignedUploadUrl.Length != 0) hash ^= SignedUploadUrl.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Ok != false) { + output.WriteRawTag(8); + output.WriteBool(Ok); + } + if (SignedUploadUrl.Length != 0) { + output.WriteRawTag(18); + output.WriteString(SignedUploadUrl); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Ok != false) { + output.WriteRawTag(8); + output.WriteBool(Ok); + } + if (SignedUploadUrl.Length != 0) { + output.WriteRawTag(18); + output.WriteString(SignedUploadUrl); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Ok != false) { + size += 1 + 1; + } + if (SignedUploadUrl.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SignedUploadUrl); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CreateCacheEntryResponse other) { + if (other == null) { + return; + } + if (other.Ok != false) { + Ok = other.Ok; + } + if (other.SignedUploadUrl.Length != 0) { + SignedUploadUrl = other.SignedUploadUrl; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Ok = input.ReadBool(); + break; + } + case 18: { + SignedUploadUrl = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Ok = input.ReadBool(); + break; + } + case 18: { + SignedUploadUrl = input.ReadString(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class FinalizeCacheEntryUploadRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FinalizeCacheEntryUploadRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Github.Actions.Results.Api.V1.CacheReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public FinalizeCacheEntryUploadRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public FinalizeCacheEntryUploadRequest(FinalizeCacheEntryUploadRequest other) : this() { + metadata_ = other.metadata_ != null ? other.metadata_.Clone() : null; + key_ = other.key_; + sizeBytes_ = other.sizeBytes_; + version_ = other.version_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public FinalizeCacheEntryUploadRequest Clone() { + return new FinalizeCacheEntryUploadRequest(this); + } + + /// Field number for the "metadata" field. + public const int MetadataFieldNumber = 1; + private global::Github.Actions.Results.Entities.V1.CacheMetadata metadata_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Github.Actions.Results.Entities.V1.CacheMetadata Metadata { + get { return metadata_; } + set { + metadata_ = value; + } + } + + /// Field number for the "key" field. + public const int KeyFieldNumber = 2; + private string key_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "size_bytes" field. + public const int SizeBytesFieldNumber = 3; + private long sizeBytes_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long SizeBytes { + get { return sizeBytes_; } + set { + sizeBytes_ = value; + } + } + + /// Field number for the "version" field. + public const int VersionFieldNumber = 4; + private string version_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Version { + get { return version_; } + set { + version_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as FinalizeCacheEntryUploadRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(FinalizeCacheEntryUploadRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Metadata, other.Metadata)) return false; + if (Key != other.Key) return false; + if (SizeBytes != other.SizeBytes) return false; + if (Version != other.Version) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (metadata_ != null) hash ^= Metadata.GetHashCode(); + if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (SizeBytes != 0L) hash ^= SizeBytes.GetHashCode(); + if (Version.Length != 0) hash ^= Version.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (metadata_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Metadata); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Key); + } + if (SizeBytes != 0L) { + output.WriteRawTag(24); + output.WriteInt64(SizeBytes); + } + if (Version.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Version); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (metadata_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Metadata); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Key); + } + if (SizeBytes != 0L) { + output.WriteRawTag(24); + output.WriteInt64(SizeBytes); + } + if (Version.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Version); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (metadata_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Metadata); + } + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + } + if (SizeBytes != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(SizeBytes); + } + if (Version.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Version); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(FinalizeCacheEntryUploadRequest other) { + if (other == null) { + return; + } + if (other.metadata_ != null) { + if (metadata_ == null) { + Metadata = new global::Github.Actions.Results.Entities.V1.CacheMetadata(); + } + Metadata.MergeFrom(other.Metadata); + } + if (other.Key.Length != 0) { + Key = other.Key; + } + if (other.SizeBytes != 0L) { + SizeBytes = other.SizeBytes; + } + if (other.Version.Length != 0) { + Version = other.Version; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (metadata_ == null) { + Metadata = new global::Github.Actions.Results.Entities.V1.CacheMetadata(); + } + input.ReadMessage(Metadata); + break; + } + case 18: { + Key = input.ReadString(); + break; + } + case 24: { + SizeBytes = input.ReadInt64(); + break; + } + case 34: { + Version = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (metadata_ == null) { + Metadata = new global::Github.Actions.Results.Entities.V1.CacheMetadata(); + } + input.ReadMessage(Metadata); + break; + } + case 18: { + Key = input.ReadString(); + break; + } + case 24: { + SizeBytes = input.ReadInt64(); + break; + } + case 34: { + Version = input.ReadString(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class FinalizeCacheEntryUploadResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FinalizeCacheEntryUploadResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Github.Actions.Results.Api.V1.CacheReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public FinalizeCacheEntryUploadResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public FinalizeCacheEntryUploadResponse(FinalizeCacheEntryUploadResponse other) : this() { + ok_ = other.ok_; + entryId_ = other.entryId_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public FinalizeCacheEntryUploadResponse Clone() { + return new FinalizeCacheEntryUploadResponse(this); + } + + /// Field number for the "ok" field. + public const int OkFieldNumber = 1; + private bool ok_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Ok { + get { return ok_; } + set { + ok_ = value; + } + } + + /// Field number for the "entry_id" field. + public const int EntryIdFieldNumber = 2; + private long entryId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long EntryId { + get { return entryId_; } + set { + entryId_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as FinalizeCacheEntryUploadResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(FinalizeCacheEntryUploadResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Ok != other.Ok) return false; + if (EntryId != other.EntryId) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Ok != false) hash ^= Ok.GetHashCode(); + if (EntryId != 0L) hash ^= EntryId.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Ok != false) { + output.WriteRawTag(8); + output.WriteBool(Ok); + } + if (EntryId != 0L) { + output.WriteRawTag(16); + output.WriteInt64(EntryId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Ok != false) { + output.WriteRawTag(8); + output.WriteBool(Ok); + } + if (EntryId != 0L) { + output.WriteRawTag(16); + output.WriteInt64(EntryId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Ok != false) { + size += 1 + 1; + } + if (EntryId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(EntryId); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(FinalizeCacheEntryUploadResponse other) { + if (other == null) { + return; + } + if (other.Ok != false) { + Ok = other.Ok; + } + if (other.EntryId != 0L) { + EntryId = other.EntryId; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Ok = input.ReadBool(); + break; + } + case 16: { + EntryId = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Ok = input.ReadBool(); + break; + } + case 16: { + EntryId = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class GetCacheEntryDownloadURLRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetCacheEntryDownloadURLRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Github.Actions.Results.Api.V1.CacheReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetCacheEntryDownloadURLRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetCacheEntryDownloadURLRequest(GetCacheEntryDownloadURLRequest other) : this() { + metadata_ = other.metadata_ != null ? other.metadata_.Clone() : null; + key_ = other.key_; + restoreKeys_ = other.restoreKeys_.Clone(); + version_ = other.version_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetCacheEntryDownloadURLRequest Clone() { + return new GetCacheEntryDownloadURLRequest(this); + } + + /// Field number for the "metadata" field. + public const int MetadataFieldNumber = 1; + private global::Github.Actions.Results.Entities.V1.CacheMetadata metadata_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Github.Actions.Results.Entities.V1.CacheMetadata Metadata { + get { return metadata_; } + set { + metadata_ = value; + } + } + + /// Field number for the "key" field. + public const int KeyFieldNumber = 2; + private string key_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "restore_keys" field. + public const int RestoreKeysFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_restoreKeys_codec + = pb::FieldCodec.ForString(26); + private readonly pbc::RepeatedField restoreKeys_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField RestoreKeys { + get { return restoreKeys_; } + } + + /// Field number for the "version" field. + public const int VersionFieldNumber = 4; + private string version_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Version { + get { return version_; } + set { + version_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as GetCacheEntryDownloadURLRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(GetCacheEntryDownloadURLRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Metadata, other.Metadata)) return false; + if (Key != other.Key) return false; + if(!restoreKeys_.Equals(other.restoreKeys_)) return false; + if (Version != other.Version) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (metadata_ != null) hash ^= Metadata.GetHashCode(); + if (Key.Length != 0) hash ^= Key.GetHashCode(); + hash ^= restoreKeys_.GetHashCode(); + if (Version.Length != 0) hash ^= Version.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (metadata_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Metadata); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Key); + } + restoreKeys_.WriteTo(output, _repeated_restoreKeys_codec); + if (Version.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Version); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (metadata_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Metadata); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Key); + } + restoreKeys_.WriteTo(ref output, _repeated_restoreKeys_codec); + if (Version.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Version); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (metadata_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Metadata); + } + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + } + size += restoreKeys_.CalculateSize(_repeated_restoreKeys_codec); + if (Version.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Version); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(GetCacheEntryDownloadURLRequest other) { + if (other == null) { + return; + } + if (other.metadata_ != null) { + if (metadata_ == null) { + Metadata = new global::Github.Actions.Results.Entities.V1.CacheMetadata(); + } + Metadata.MergeFrom(other.Metadata); + } + if (other.Key.Length != 0) { + Key = other.Key; + } + restoreKeys_.Add(other.restoreKeys_); + if (other.Version.Length != 0) { + Version = other.Version; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (metadata_ == null) { + Metadata = new global::Github.Actions.Results.Entities.V1.CacheMetadata(); + } + input.ReadMessage(Metadata); + break; + } + case 18: { + Key = input.ReadString(); + break; + } + case 26: { + restoreKeys_.AddEntriesFrom(input, _repeated_restoreKeys_codec); + break; + } + case 34: { + Version = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (metadata_ == null) { + Metadata = new global::Github.Actions.Results.Entities.V1.CacheMetadata(); + } + input.ReadMessage(Metadata); + break; + } + case 18: { + Key = input.ReadString(); + break; + } + case 26: { + restoreKeys_.AddEntriesFrom(ref input, _repeated_restoreKeys_codec); + break; + } + case 34: { + Version = input.ReadString(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class GetCacheEntryDownloadURLResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetCacheEntryDownloadURLResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Github.Actions.Results.Api.V1.CacheReflection.Descriptor.MessageTypes[5]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetCacheEntryDownloadURLResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetCacheEntryDownloadURLResponse(GetCacheEntryDownloadURLResponse other) : this() { + ok_ = other.ok_; + signedDownloadUrl_ = other.signedDownloadUrl_; + matchedKey_ = other.matchedKey_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetCacheEntryDownloadURLResponse Clone() { + return new GetCacheEntryDownloadURLResponse(this); + } + + /// Field number for the "ok" field. + public const int OkFieldNumber = 1; + private bool ok_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Ok { + get { return ok_; } + set { + ok_ = value; + } + } + + /// Field number for the "signed_download_url" field. + public const int SignedDownloadUrlFieldNumber = 2; + private string signedDownloadUrl_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string SignedDownloadUrl { + get { return signedDownloadUrl_; } + set { + signedDownloadUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "matched_key" field. + public const int MatchedKeyFieldNumber = 3; + private string matchedKey_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string MatchedKey { + get { return matchedKey_; } + set { + matchedKey_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as GetCacheEntryDownloadURLResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(GetCacheEntryDownloadURLResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Ok != other.Ok) return false; + if (SignedDownloadUrl != other.SignedDownloadUrl) return false; + if (MatchedKey != other.MatchedKey) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Ok != false) hash ^= Ok.GetHashCode(); + if (SignedDownloadUrl.Length != 0) hash ^= SignedDownloadUrl.GetHashCode(); + if (MatchedKey.Length != 0) hash ^= MatchedKey.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Ok != false) { + output.WriteRawTag(8); + output.WriteBool(Ok); + } + if (SignedDownloadUrl.Length != 0) { + output.WriteRawTag(18); + output.WriteString(SignedDownloadUrl); + } + if (MatchedKey.Length != 0) { + output.WriteRawTag(26); + output.WriteString(MatchedKey); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Ok != false) { + output.WriteRawTag(8); + output.WriteBool(Ok); + } + if (SignedDownloadUrl.Length != 0) { + output.WriteRawTag(18); + output.WriteString(SignedDownloadUrl); + } + if (MatchedKey.Length != 0) { + output.WriteRawTag(26); + output.WriteString(MatchedKey); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Ok != false) { + size += 1 + 1; + } + if (SignedDownloadUrl.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SignedDownloadUrl); + } + if (MatchedKey.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(MatchedKey); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(GetCacheEntryDownloadURLResponse other) { + if (other == null) { + return; + } + if (other.Ok != false) { + Ok = other.Ok; + } + if (other.SignedDownloadUrl.Length != 0) { + SignedDownloadUrl = other.SignedDownloadUrl; + } + if (other.MatchedKey.Length != 0) { + MatchedKey = other.MatchedKey; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Ok = input.ReadBool(); + break; + } + case 18: { + SignedDownloadUrl = input.ReadString(); + break; + } + case 26: { + MatchedKey = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Ok = input.ReadBool(); + break; + } + case 18: { + SignedDownloadUrl = input.ReadString(); + break; + } + case 26: { + MatchedKey = input.ReadString(); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/Runner.Server/Protobuf/CacheMetadata.cs b/src/Runner.Server/Protobuf/CacheMetadata.cs new file mode 100644 index 00000000000..0171eb9a4f7 --- /dev/null +++ b/src/Runner.Server/Protobuf/CacheMetadata.cs @@ -0,0 +1,506 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: cache_metadata.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Github.Actions.Results.Entities.V1 { + + /// Holder for reflection information generated from cache_metadata.proto + public static partial class CacheMetadataReflection { + + #region Descriptor + /// File descriptor for cache_metadata.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static CacheMetadataReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChRjYWNoZV9tZXRhZGF0YS5wcm90bxIiZ2l0aHViLmFjdGlvbnMucmVzdWx0", + "cy5lbnRpdGllcy52MSIvCgpDYWNoZVNjb3BlEg0KBXNjb3BlGAEgASgJEhIK", + "CnBlcm1pc3Npb24YAiABKAMiZQoNQ2FjaGVNZXRhZGF0YRIVCg1yZXBvc2l0", + "b3J5X2lkGAEgASgDEj0KBXNjb3BlGAIgAygLMi4uZ2l0aHViLmFjdGlvbnMu", + "cmVzdWx0cy5lbnRpdGllcy52MS5DYWNoZVNjb3BlYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Github.Actions.Results.Entities.V1.CacheScope), global::Github.Actions.Results.Entities.V1.CacheScope.Parser, new[]{ "Scope", "Permission" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Github.Actions.Results.Entities.V1.CacheMetadata), global::Github.Actions.Results.Entities.V1.CacheMetadata.Parser, new[]{ "RepositoryId", "Scope" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class CacheScope : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CacheScope()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Github.Actions.Results.Entities.V1.CacheMetadataReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CacheScope() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CacheScope(CacheScope other) : this() { + scope_ = other.scope_; + permission_ = other.permission_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CacheScope Clone() { + return new CacheScope(this); + } + + /// Field number for the "scope" field. + public const int ScopeFieldNumber = 1; + private string scope_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Scope { + get { return scope_; } + set { + scope_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "permission" field. + public const int PermissionFieldNumber = 2; + private long permission_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Permission { + get { return permission_; } + set { + permission_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CacheScope); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CacheScope other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Scope != other.Scope) return false; + if (Permission != other.Permission) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Scope.Length != 0) hash ^= Scope.GetHashCode(); + if (Permission != 0L) hash ^= Permission.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Scope.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Scope); + } + if (Permission != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Permission); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Scope.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Scope); + } + if (Permission != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Permission); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Scope.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Scope); + } + if (Permission != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Permission); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CacheScope other) { + if (other == null) { + return; + } + if (other.Scope.Length != 0) { + Scope = other.Scope; + } + if (other.Permission != 0L) { + Permission = other.Permission; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Scope = input.ReadString(); + break; + } + case 16: { + Permission = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Scope = input.ReadString(); + break; + } + case 16: { + Permission = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class CacheMetadata : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CacheMetadata()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Github.Actions.Results.Entities.V1.CacheMetadataReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CacheMetadata() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CacheMetadata(CacheMetadata other) : this() { + repositoryId_ = other.repositoryId_; + scope_ = other.scope_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CacheMetadata Clone() { + return new CacheMetadata(this); + } + + /// Field number for the "repository_id" field. + public const int RepositoryIdFieldNumber = 1; + private long repositoryId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long RepositoryId { + get { return repositoryId_; } + set { + repositoryId_ = value; + } + } + + /// Field number for the "scope" field. + public const int ScopeFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_scope_codec + = pb::FieldCodec.ForMessage(18, global::Github.Actions.Results.Entities.V1.CacheScope.Parser); + private readonly pbc::RepeatedField scope_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Scope { + get { return scope_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CacheMetadata); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CacheMetadata other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (RepositoryId != other.RepositoryId) return false; + if(!scope_.Equals(other.scope_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (RepositoryId != 0L) hash ^= RepositoryId.GetHashCode(); + hash ^= scope_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (RepositoryId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(RepositoryId); + } + scope_.WriteTo(output, _repeated_scope_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (RepositoryId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(RepositoryId); + } + scope_.WriteTo(ref output, _repeated_scope_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (RepositoryId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(RepositoryId); + } + size += scope_.CalculateSize(_repeated_scope_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CacheMetadata other) { + if (other == null) { + return; + } + if (other.RepositoryId != 0L) { + RepositoryId = other.RepositoryId; + } + scope_.Add(other.scope_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + RepositoryId = input.ReadInt64(); + break; + } + case 18: { + scope_.AddEntriesFrom(input, _repeated_scope_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + RepositoryId = input.ReadInt64(); + break; + } + case 18: { + scope_.AddEntriesFrom(ref input, _repeated_scope_codec); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/Runner.Server/Protobuf/ProtobufAttribute.cs b/src/Runner.Server/Protobuf/ProtobufAttribute.cs new file mode 100644 index 00000000000..9e73c858f70 --- /dev/null +++ b/src/Runner.Server/Protobuf/ProtobufAttribute.cs @@ -0,0 +1,40 @@ +using System.IO; +using System.Reflection; +using System.Threading.Tasks; +using Google.Protobuf; +using Google.Protobuf.Reflection; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.ModelBinding; + +namespace Runner.Server { + public class ProtobufBinder : IModelBinder + { + public async Task BindModelAsync(ModelBindingContext bindingContext) + { + if (!bindingContext.HttpContext.Request.HasJsonContentType()) + { + throw new BadHttpRequestException( + "Request content type was not a recognized JSON content type.", + StatusCodes.Status415UnsupportedMediaType); + } + + using var sr = new StreamReader(bindingContext.HttpContext.Request.Body); + var str = await sr.ReadToEndAsync(); + + var valueType = bindingContext.ModelType; + var parser = new JsonParser(JsonParser.Settings.Default.WithIgnoreUnknownFields(true)); + + var descriptor = (MessageDescriptor)bindingContext.ModelType.GetProperty("Descriptor", BindingFlags.Public | BindingFlags.Static).GetValue(null, null); + var obj = parser.Parse(str, descriptor); + + bindingContext.Result = ModelBindingResult.Success(obj); + } + } + + public class ProtobufAttribute : ModelBinderAttribute { + public ProtobufAttribute() : base(typeof(ProtobufBinder)) { + + } + } +} \ No newline at end of file diff --git a/src/Runner.Server/Protobuf/cache.proto b/src/Runner.Server/Protobuf/cache.proto new file mode 100644 index 00000000000..34088132e72 --- /dev/null +++ b/src/Runner.Server/Protobuf/cache.proto @@ -0,0 +1,41 @@ +syntax = "proto3"; + +package github.actions.results.api.v1; + +import "cache_metadata.proto"; + +message CreateCacheEntryRequest { + github.actions.results.entities.v1.CacheMetadata metadata = 1; + string key = 2; + string version = 3; +} + +message CreateCacheEntryResponse { + bool ok = 1; + string signed_upload_url = 2; +} + +message FinalizeCacheEntryUploadRequest { + github.actions.results.entities.v1.CacheMetadata metadata = 1; + string key = 2; + int64 size_bytes = 3; + string version = 4; +} + +message FinalizeCacheEntryUploadResponse { + bool ok = 1; + int64 entry_id = 2; +} + +message GetCacheEntryDownloadURLRequest { + github.actions.results.entities.v1.CacheMetadata metadata = 1; + string key = 2; + repeated string restore_keys = 3; + string version = 4; +} + +message GetCacheEntryDownloadURLResponse { + bool ok = 1; + string signed_download_url = 2; + string matched_key = 3; +} diff --git a/src/Runner.Server/Protobuf/cache_metadata.proto b/src/Runner.Server/Protobuf/cache_metadata.proto new file mode 100644 index 00000000000..f325d91de0d --- /dev/null +++ b/src/Runner.Server/Protobuf/cache_metadata.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +package github.actions.results.entities.v1; + +message CacheScope { + string scope = 1; + int64 permission = 2; +} + +message CacheMetadata { + int64 repository_id = 1; + repeated CacheScope scope = 2; +} \ No newline at end of file