-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Serialization; | ||
|
||
namespace Uralstech.UCloud.Operations.Generic | ||
{ | ||
/// <summary> | ||
/// This resource represents a long-running operation that is the result of a network API call. | ||
/// </summary> | ||
/// <typeparam name="TMetadata">The type of the operation's metadata.</typeparam> | ||
/// <typeparam name="TResponse">The type of the operation's response.</typeparam> | ||
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))] | ||
public class Operation<TMetadata, TResponse> | ||
{ | ||
/// <summary> | ||
/// The server-assigned name, which is only unique within the same service that originally returns it. | ||
/// </summary> | ||
/// <remarks> | ||
/// If you use the default HTTP mapping, the name should be a resource name ending with operations/{unique_id}. | ||
/// </remarks> | ||
public string Name; | ||
|
||
/// <summary> | ||
/// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. | ||
/// </summary> | ||
/// <remarks> | ||
/// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. | ||
/// </remarks> | ||
public TMetadata Metadata = default; | ||
|
||
/// <summary> | ||
/// If the value is false, it means the operation is still in progress. | ||
/// If true, the operation is completed, and either <see cref="Error"/> or <see cref="Response"/> is available. | ||
/// </summary> | ||
public bool Done; | ||
|
||
/// <summary> | ||
/// The error result of the operation in case of failure or cancellation. | ||
/// </summary> | ||
public OperationStatus Error = null; | ||
|
||
/// <summary> | ||
/// The normal response of the operation in case of success. If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. | ||
/// </summary> | ||
/// <remarks> | ||
/// If the original method is standard Get/Create/Update, the response should be the resource. For other methods, the response should have the type XxxResponse,<br/> | ||
/// where Xxx is the original method name. For example, if the original method name is TakeSnapshot(), the inferred response type is TakeSnapshotResponse. | ||
/// </remarks> | ||
public TResponse Response = default; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
namespace Uralstech.UCloud.Operations | ||
{ | ||
/// <summary> | ||
/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. | ||
/// </summary> | ||
/// <remarks> | ||
/// Return type is <see cref="Operation"/> or <see cref="Generic.Operation{TMetadata, TResponse}"/>. | ||
/// </remarks> | ||
public class OperationGetRequest : IOperationsGetRequest | ||
{ | ||
/// <summary> | ||
/// The resource name of the operation to get. | ||
/// </summary> | ||
public string OperationName; | ||
|
||
/// <inheritdoc/> | ||
public string GetEndpointUri() | ||
{ | ||
return $"https://servicemanagement.googleapis.com/v1/{OperationName}"; | ||
} | ||
|
||
/// <summary> | ||
/// Creates a new <see cref="OperationGetRequest"/>. | ||
/// </summary> | ||
/// <param name="operationName">The resource name of the operation to get.</param> | ||
public OperationGetRequest(string operationName) | ||
{ | ||
OperationName = operationName; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Serialization; | ||
|
||
namespace Uralstech.UCloud.Operations.Generic | ||
{ | ||
/// <summary> | ||
/// The generic response for an <see cref="OperationsListRequest"/> call. | ||
/// </summary> | ||
/// <typeparam name="TMetadata">The type of the operation's metadata.</typeparam> | ||
/// <typeparam name="TResponse">The type of the operation's response.</typeparam> | ||
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))] | ||
public class OperationsListResponse<TMetadata, TResponse> | ||
{ | ||
/// <summary> | ||
/// A list of operations that matches the specified filter in the request. | ||
/// </summary> | ||
public Operation<TMetadata, TResponse>[] Operations; | ||
|
||
/// <summary> | ||
/// A token that can be sent as a <see cref="OperationsListRequest.PageToken"/> into a subsequent <see cref="OperationsListRequest"/> call. | ||
/// </summary> | ||
public string NextPageToken; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
namespace Uralstech.UCloud.Operations | ||
{ | ||
/// <summary> | ||
/// Requests metadata for an operation. Return type is <see cref="OperationsListResponse"/> or <see cref="Generic.OperationsListResponse{TMetadata, TResponse}"/>. | ||
/// </summary> | ||
public class OperationsListRequest : IOperationsGetRequest | ||
{ | ||
/// <summary> | ||
/// The maximum number of <see cref="Operation"/>s to return (per page). | ||
/// </summary> | ||
/// <remarks> | ||
/// This method returns at most 100 operations per page. | ||
/// </remarks> | ||
public int MaxResponseOperations = 50; | ||
|
||
/// <summary> | ||
/// A page token from a previous <see cref="OperationsListRequest"/> call. | ||
/// </summary> | ||
public string PageToken = string.Empty; | ||
|
||
/// <inheritdoc/> | ||
public string GetEndpointUri() | ||
{ | ||
return string.IsNullOrEmpty(PageToken) | ||
? $"https://servicemanagement.googleapis.com/v1/operations?pageSize={MaxResponseOperations}" | ||
: $"https://servicemanagement.googleapis.com/v1/operations?pageSize={MaxResponseOperations}&pageToken={PageToken}"; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Serialization; | ||
|
||
namespace Uralstech.UCloud.Operations | ||
{ | ||
/// <summary> | ||
/// The response for an <see cref="OperationsListRequest"/> call. | ||
/// </summary> | ||
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))] | ||
public class OperationsListResponse | ||
{ | ||
/// <summary> | ||
/// A list of operations that matches the specified filter in the request. | ||
/// </summary> | ||
public Operation[] Operations; | ||
|
||
/// <summary> | ||
/// A token that can be sent as a <see cref="OperationsListRequest.PageToken"/> into a subsequent <see cref="OperationsListRequest"/> call. | ||
/// </summary> | ||
public string NextPageToken; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Serialization; | ||
|
||
namespace Uralstech.UCloud.Operations | ||
{ | ||
/// <summary> | ||
/// This resource represents a long-running operation that is the result of a network API call. | ||
/// </summary> | ||
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))] | ||
public class Operation : Generic.Operation<ProtobufObject, ProtobufObject> { } | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Serialization; | ||
|
||
namespace Uralstech.UCloud.Operations | ||
{ | ||
/// <summary> | ||
/// The <see cref="OperationStatus"/> type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC. | ||
/// </summary> | ||
/// <remarks> | ||
/// Each <see cref="OperationStatus"/> message contains three pieces of data: error code, error message, and error details. | ||
/// </remarks> | ||
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))] | ||
public class OperationStatus | ||
{ | ||
/// <summary> | ||
/// The status code, which should be an enum value of google.rpc.Code. | ||
/// </summary> | ||
public int Code; | ||
|
||
/// <summary> | ||
/// A developer-facing error message, which should be in English. | ||
/// </summary> | ||
/// <remarks> | ||
/// Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client. | ||
/// </remarks> | ||
public string Message; | ||
|
||
/// <summary> | ||
/// A list of messages that carry the error details. There is a common set of message types for APIs to use. | ||
/// </summary> | ||
public ProtobufObject[] Details; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
using Newtonsoft.Json.Serialization; | ||
using System.Collections.Generic; | ||
|
||
namespace Uralstech.UCloud | ||
{ | ||
/// <summary> | ||
/// An object containing fields of an arbitrary type. | ||
/// </summary> | ||
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))] | ||
public class ProtobufObject | ||
{ | ||
/// <summary> | ||
/// Contains a URI identifying the type. | ||
/// </summary> | ||
[JsonProperty("@type")] | ||
public string Type; | ||
|
||
/// <summary> | ||
/// The actual details of the <see cref="ProtobufObject"/> object. | ||
/// </summary> | ||
[JsonExtensionData] | ||
public Dictionary<string, JToken> Data; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.