From bd5efbfa13927f872a80b7a4bae78b843ed9cf11 Mon Sep 17 00:00:00 2001 From: Rey DeLeon Date: Wed, 12 Jun 2024 14:31:26 -0600 Subject: [PATCH 1/8] first attempt at LRO --- .../api/additive/v0/additive_simulation.proto | 25 +- csharp/Ansys.Api.Additive.csproj | 5 +- google/api/client.proto | 427 ++++++++++++++++++ google/api/http.proto | 15 +- google/api/launch_stage.proto | 72 +++ google/longrunning/operations.proto | 247 ++++++++++ google/rpc/status.proto | 49 ++ 7 files changed, 828 insertions(+), 12 deletions(-) create mode 100644 google/api/client.proto create mode 100644 google/api/launch_stage.proto create mode 100644 google/longrunning/operations.proto create mode 100644 google/rpc/status.proto diff --git a/ansys/api/additive/v0/additive_simulation.proto b/ansys/api/additive/v0/additive_simulation.proto index e418ba4..57ae2d4 100644 --- a/ansys/api/additive/v0/additive_simulation.proto +++ b/ansys/api/additive/v0/additive_simulation.proto @@ -6,12 +6,29 @@ package ansys.api.additive.v0.simulation; option csharp_namespace = "Ansys.Api.Additive.Simulation"; import "ansys/api/additive/v0/additive_domain.proto"; +import "google/longrunning/operations.proto"; service SimulationService { - rpc Simulate(SimulationRequest) returns (stream SimulationResponse); - rpc UploadFile(stream UploadFileRequest) returns (stream UploadFileResponse); - rpc DownloadFile(DownloadFileRequest) returns (stream DownloadFileResponse); - rpc Mesh(MeshRequest) returns (stream MeshResponse); + rpc Simulate(SimulationRequest) returns (google.longrunning.Operation) { + option (google.longrunning.operation_info) = { + response_type: "SimulationResponse" + }; + } + rpc UploadFile(stream UploadFileRequest) returns (google.longrunning.Operation) { + option (google.longrunning.operation_info) = { + response_type: "UploadFileResponse" + }; + } + rpc DownloadFile(DownloadFileRequest) returns (google.longrunning.Operation) { + option (google.longrunning.operation_info) = { + response_type: "DownloadFileResponse" + }; + } + rpc Mesh(MeshRequest) returns (google.longrunning.Operation) { + option (google.longrunning.operation_info) = { + response_type: "MeshResponse" + }; + } } message SimulationResponse { diff --git a/csharp/Ansys.Api.Additive.csproj b/csharp/Ansys.Api.Additive.csproj index 5794c5a..d598876 100644 --- a/csharp/Ansys.Api.Additive.csproj +++ b/csharp/Ansys.Api.Additive.csproj @@ -14,8 +14,9 @@ - - + + + all runtime; build; native; contentfiles; analyzers diff --git a/google/api/client.proto b/google/api/client.proto new file mode 100644 index 0000000..0952e83 --- /dev/null +++ b/google/api/client.proto @@ -0,0 +1,427 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api; + +import "google/api/launch_stage.proto"; +import "google/protobuf/descriptor.proto"; +import "google/protobuf/duration.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; +option java_multiple_files = true; +option java_outer_classname = "ClientProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +extend google.protobuf.MethodOptions { + // A definition of a client library method signature. + // + // In client libraries, each proto RPC corresponds to one or more methods + // which the end user is able to call, and calls the underlying RPC. + // Normally, this method receives a single argument (a struct or instance + // corresponding to the RPC request object). Defining this field will + // add one or more overloads providing flattened or simpler method signatures + // in some languages. + // + // The fields on the method signature are provided as a comma-separated + // string. + // + // For example, the proto RPC and annotation: + // + // rpc CreateSubscription(CreateSubscriptionRequest) + // returns (Subscription) { + // option (google.api.method_signature) = "name,topic"; + // } + // + // Would add the following Java overload (in addition to the method accepting + // the request object): + // + // public final Subscription createSubscription(String name, String topic) + // + // The following backwards-compatibility guidelines apply: + // + // * Adding this annotation to an unannotated method is backwards + // compatible. + // * Adding this annotation to a method which already has existing + // method signature annotations is backwards compatible if and only if + // the new method signature annotation is last in the sequence. + // * Modifying or removing an existing method signature annotation is + // a breaking change. + // * Re-ordering existing method signature annotations is a breaking + // change. + repeated string method_signature = 1051; +} + +extend google.protobuf.ServiceOptions { + // The hostname for this service. + // This should be specified with no prefix or protocol. + // + // Example: + // + // service Foo { + // option (google.api.default_host) = "foo.googleapi.com"; + // ... + // } + string default_host = 1049; + + // OAuth scopes needed for the client. + // + // Example: + // + // service Foo { + // option (google.api.oauth_scopes) = \ + // "https://www.googleapis.com/auth/cloud-platform"; + // ... + // } + // + // If there is more than one scope, use a comma-separated string: + // + // Example: + // + // service Foo { + // option (google.api.oauth_scopes) = \ + // "https://www.googleapis.com/auth/cloud-platform," + // "https://www.googleapis.com/auth/monitoring"; + // ... + // } + string oauth_scopes = 1050; + + // The API version of this service, which should be sent by version-aware + // clients to the service. This allows services to abide by the schema and + // behavior of the service at the time this API version was deployed. + // The format of the API version must be treated as opaque by clients. + // Services may use a format with an apparent structure, but clients must + // not rely on this to determine components within an API version, or attempt + // to construct other valid API versions. Note that this is for upcoming + // functionality and may not be implemented for all services. + // + // Example: + // + // service Foo { + // option (google.api.api_version) = "v1_20230821_preview"; + // } + string api_version = 525000001; +} + +// Required information for every language. +message CommonLanguageSettings { + // Link to automatically generated reference documentation. Example: + // https://cloud.google.com/nodejs/docs/reference/asset/latest + string reference_docs_uri = 1 [deprecated = true]; + + // The destination where API teams want this client library to be published. + repeated ClientLibraryDestination destinations = 2; +} + +// Details about how and where to publish client libraries. +message ClientLibrarySettings { + // Version of the API to apply these settings to. This is the full protobuf + // package for the API, ending in the version element. + // Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1". + string version = 1; + + // Launch stage of this version of the API. + LaunchStage launch_stage = 2; + + // When using transport=rest, the client request will encode enums as + // numbers rather than strings. + bool rest_numeric_enums = 3; + + // Settings for legacy Java features, supported in the Service YAML. + JavaSettings java_settings = 21; + + // Settings for C++ client libraries. + CppSettings cpp_settings = 22; + + // Settings for PHP client libraries. + PhpSettings php_settings = 23; + + // Settings for Python client libraries. + PythonSettings python_settings = 24; + + // Settings for Node client libraries. + NodeSettings node_settings = 25; + + // Settings for .NET client libraries. + DotnetSettings dotnet_settings = 26; + + // Settings for Ruby client libraries. + RubySettings ruby_settings = 27; + + // Settings for Go client libraries. + GoSettings go_settings = 28; +} + +// This message configures the settings for publishing [Google Cloud Client +// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries) +// generated from the service config. +message Publishing { + // A list of API method settings, e.g. the behavior for methods that use the + // long-running operation pattern. + repeated MethodSettings method_settings = 2; + + // Link to a *public* URI where users can report issues. Example: + // https://issuetracker.google.com/issues/new?component=190865&template=1161103 + string new_issue_uri = 101; + + // Link to product home page. Example: + // https://cloud.google.com/asset-inventory/docs/overview + string documentation_uri = 102; + + // Used as a tracking tag when collecting data about the APIs developer + // relations artifacts like docs, packages delivered to package managers, + // etc. Example: "speech". + string api_short_name = 103; + + // GitHub label to apply to issues and pull requests opened for this API. + string github_label = 104; + + // GitHub teams to be added to CODEOWNERS in the directory in GitHub + // containing source code for the client libraries for this API. + repeated string codeowner_github_teams = 105; + + // A prefix used in sample code when demarking regions to be included in + // documentation. + string doc_tag_prefix = 106; + + // For whom the client library is being published. + ClientLibraryOrganization organization = 107; + + // Client library settings. If the same version string appears multiple + // times in this list, then the last one wins. Settings from earlier + // settings with the same version string are discarded. + repeated ClientLibrarySettings library_settings = 109; + + // Optional link to proto reference documentation. Example: + // https://cloud.google.com/pubsub/lite/docs/reference/rpc + string proto_reference_documentation_uri = 110; + + // Optional link to REST reference documentation. Example: + // https://cloud.google.com/pubsub/lite/docs/reference/rest + string rest_reference_documentation_uri = 111; +} + +// Settings for Java client libraries. +message JavaSettings { + // The package name to use in Java. Clobbers the java_package option + // set in the protobuf. This should be used **only** by APIs + // who have already set the language_settings.java.package_name" field + // in gapic.yaml. API teams should use the protobuf java_package option + // where possible. + // + // Example of a YAML configuration:: + // + // publishing: + // java_settings: + // library_package: com.google.cloud.pubsub.v1 + string library_package = 1; + + // Configure the Java class name to use instead of the service's for its + // corresponding generated GAPIC client. Keys are fully-qualified + // service names as they appear in the protobuf (including the full + // the language_settings.java.interface_names" field in gapic.yaml. API + // teams should otherwise use the service name as it appears in the + // protobuf. + // + // Example of a YAML configuration:: + // + // publishing: + // java_settings: + // service_class_names: + // - google.pubsub.v1.Publisher: TopicAdmin + // - google.pubsub.v1.Subscriber: SubscriptionAdmin + map service_class_names = 2; + + // Some settings. + CommonLanguageSettings common = 3; +} + +// Settings for C++ client libraries. +message CppSettings { + // Some settings. + CommonLanguageSettings common = 1; +} + +// Settings for Php client libraries. +message PhpSettings { + // Some settings. + CommonLanguageSettings common = 1; +} + +// Settings for Python client libraries. +message PythonSettings { + // Some settings. + CommonLanguageSettings common = 1; +} + +// Settings for Node client libraries. +message NodeSettings { + // Some settings. + CommonLanguageSettings common = 1; +} + +// Settings for Dotnet client libraries. +message DotnetSettings { + // Some settings. + CommonLanguageSettings common = 1; + + // Map from original service names to renamed versions. + // This is used when the default generated types + // would cause a naming conflict. (Neither name is + // fully-qualified.) + // Example: Subscriber to SubscriberServiceApi. + map renamed_services = 2; + + // Map from full resource types to the effective short name + // for the resource. This is used when otherwise resource + // named from different services would cause naming collisions. + // Example entry: + // "datalabeling.googleapis.com/Dataset": "DataLabelingDataset" + map renamed_resources = 3; + + // List of full resource types to ignore during generation. + // This is typically used for API-specific Location resources, + // which should be handled by the generator as if they were actually + // the common Location resources. + // Example entry: "documentai.googleapis.com/Location" + repeated string ignored_resources = 4; + + // Namespaces which must be aliased in snippets due to + // a known (but non-generator-predictable) naming collision + repeated string forced_namespace_aliases = 5; + + // Method signatures (in the form "service.method(signature)") + // which are provided separately, so shouldn't be generated. + // Snippets *calling* these methods are still generated, however. + repeated string handwritten_signatures = 6; +} + +// Settings for Ruby client libraries. +message RubySettings { + // Some settings. + CommonLanguageSettings common = 1; +} + +// Settings for Go client libraries. +message GoSettings { + // Some settings. + CommonLanguageSettings common = 1; +} + +// Describes the generator configuration for a method. +message MethodSettings { + // Describes settings to use when generating API methods that use the + // long-running operation pattern. + // All default values below are from those used in the client library + // generators (e.g. + // [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)). + message LongRunning { + // Initial delay after which the first poll request will be made. + // Default value: 5 seconds. + google.protobuf.Duration initial_poll_delay = 1; + + // Multiplier to gradually increase delay between subsequent polls until it + // reaches max_poll_delay. + // Default value: 1.5. + float poll_delay_multiplier = 2; + + // Maximum time between two subsequent poll requests. + // Default value: 45 seconds. + google.protobuf.Duration max_poll_delay = 3; + + // Total polling timeout. + // Default value: 5 minutes. + google.protobuf.Duration total_poll_timeout = 4; + } + + // The fully qualified name of the method, for which the options below apply. + // This is used to find the method to apply the options. + string selector = 1; + + // Describes settings to use for long-running operations when generating + // API methods for RPCs. Complements RPCs that use the annotations in + // google/longrunning/operations.proto. + // + // Example of a YAML configuration:: + // + // publishing: + // method_settings: + // - selector: google.cloud.speech.v2.Speech.BatchRecognize + // long_running: + // initial_poll_delay: + // seconds: 60 # 1 minute + // poll_delay_multiplier: 1.5 + // max_poll_delay: + // seconds: 360 # 6 minutes + // total_poll_timeout: + // seconds: 54000 # 90 minutes + LongRunning long_running = 2; + + // List of top-level fields of the request message, that should be + // automatically populated by the client libraries based on their + // (google.api.field_info).format. Currently supported format: UUID4. + // + // Example of a YAML configuration: + // + // publishing: + // method_settings: + // - selector: google.example.v1.ExampleService.CreateExample + // auto_populated_fields: + // - request_id + repeated string auto_populated_fields = 3; +} + +// The organization for which the client libraries are being published. +// Affects the url where generated docs are published, etc. +enum ClientLibraryOrganization { + // Not useful. + CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0; + + // Google Cloud Platform Org. + CLOUD = 1; + + // Ads (Advertising) Org. + ADS = 2; + + // Photos Org. + PHOTOS = 3; + + // Street View Org. + STREET_VIEW = 4; + + // Shopping Org. + SHOPPING = 5; + + // Geo Org. + GEO = 6; + + // Generative AI - https://developers.generativeai.google + GENERATIVE_AI = 7; +} + +// To where should client libraries be published? +enum ClientLibraryDestination { + // Client libraries will neither be generated nor published to package + // managers. + CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0; + + // Generate the client library in a repo under github.com/googleapis, + // but don't publish it to package managers. + GITHUB = 10; + + // Publish the library to package managers like nuget.org and npmjs.com. + PACKAGE_MANAGER = 20; +} diff --git a/google/api/http.proto b/google/api/http.proto index b2977f5..afa00ae 100644 --- a/google/api/http.proto +++ b/google/api/http.proto @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC. +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,7 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// syntax = "proto3"; @@ -211,15 +210,18 @@ message Http { // 1. Leaf request fields (recursive expansion nested messages in the request // message) are classified into three categories: // - Fields referred by the path template. They are passed via the URL path. -// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP +// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They +// are passed via the HTTP // request body. // - All other fields are passed via the URL query parameters, and the // parameter name is the field path in the request message. A repeated // field can be represented as multiple query parameters under the same // name. -// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields +// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL +// query parameter, all fields // are passed via URL path and HTTP request body. -// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all +// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP +// request body, all // fields are passed via URL path and URL query parameters. // // ### Path template syntax @@ -314,7 +316,8 @@ message Http { message HttpRule { // Selects a method to which this rule applies. // - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + // Refer to [selector][google.api.DocumentationRule.selector] for syntax + // details. string selector = 1; // Determines the URL pattern is matched by this rules. This pattern can be diff --git a/google/api/launch_stage.proto b/google/api/launch_stage.proto new file mode 100644 index 0000000..9863fc2 --- /dev/null +++ b/google/api/launch_stage.proto @@ -0,0 +1,72 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api; + +option go_package = "google.golang.org/genproto/googleapis/api;api"; +option java_multiple_files = true; +option java_outer_classname = "LaunchStageProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// The launch stage as defined by [Google Cloud Platform +// Launch Stages](https://cloud.google.com/terms/launch-stages). +enum LaunchStage { + // Do not use this default value. + LAUNCH_STAGE_UNSPECIFIED = 0; + + // The feature is not yet implemented. Users can not use it. + UNIMPLEMENTED = 6; + + // Prelaunch features are hidden from users and are only visible internally. + PRELAUNCH = 7; + + // Early Access features are limited to a closed group of testers. To use + // these features, you must sign up in advance and sign a Trusted Tester + // agreement (which includes confidentiality provisions). These features may + // be unstable, changed in backward-incompatible ways, and are not + // guaranteed to be released. + EARLY_ACCESS = 1; + + // Alpha is a limited availability test for releases before they are cleared + // for widespread use. By Alpha, all significant design issues are resolved + // and we are in the process of verifying functionality. Alpha customers + // need to apply for access, agree to applicable terms, and have their + // projects allowlisted. Alpha releases don't have to be feature complete, + // no SLAs are provided, and there are no technical support obligations, but + // they will be far enough along that customers can actually use them in + // test environments or for limited-use tests -- just like they would in + // normal production cases. + ALPHA = 2; + + // Beta is the point at which we are ready to open a release for any + // customer to use. There are no SLA or technical support obligations in a + // Beta release. Products will be complete from a feature perspective, but + // may have some open outstanding issues. Beta releases are suitable for + // limited production use cases. + BETA = 3; + + // GA features are open to all developers and are considered stable and + // fully qualified for production use. + GA = 4; + + // Deprecated features are scheduled to be shut down and removed. For more + // information, see the "Deprecation Policy" section of our [Terms of + // Service](https://cloud.google.com/terms/) + // and the [Google Cloud Platform Subject to the Deprecation + // Policy](https://cloud.google.com/terms/deprecation) documentation. + DEPRECATED = 5; +} diff --git a/google/longrunning/operations.proto b/google/longrunning/operations.proto new file mode 100644 index 0000000..be8880b --- /dev/null +++ b/google/longrunning/operations.proto @@ -0,0 +1,247 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.longrunning; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/rpc/status.proto"; +import "google/protobuf/descriptor.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.LongRunning"; +option go_package = "cloud.google.com/go/longrunning/autogen/longrunningpb;longrunningpb"; +option java_multiple_files = true; +option java_outer_classname = "OperationsProto"; +option java_package = "com.google.longrunning"; +option php_namespace = "Google\\LongRunning"; + +extend google.protobuf.MethodOptions { + // Additional information regarding long-running operations. + // In particular, this specifies the types that are returned from + // long-running operations. + // + // Required for methods that return `google.longrunning.Operation`; invalid + // otherwise. + google.longrunning.OperationInfo operation_info = 1049; +} + +// Manages long-running operations with an API service. +// +// When an API method normally takes long time to complete, it can be designed +// to return [Operation][google.longrunning.Operation] to the client, and the client can use this +// interface to receive the real response asynchronously by polling the +// operation resource, or pass the operation resource to another API (such as +// Google Cloud Pub/Sub API) to receive the response. Any API service that +// returns long-running operations should implement the `Operations` interface +// so developers can have a consistent client experience. +service Operations { + option (google.api.default_host) = "longrunning.googleapis.com"; + + // Lists operations that match the specified filter in the request. If the + // server doesn't support this method, it returns `UNIMPLEMENTED`. + // + // NOTE: the `name` binding allows API services to override the binding + // to use different resource name schemes, such as `users/*/operations`. To + // override the binding, API services can add a binding such as + // `"/v1/{name=users/*}/operations"` to their service configuration. + // For backwards compatibility, the default name includes the operations + // collection id, however overriding users must ensure the name binding + // is the parent resource, without the operations collection id. + rpc ListOperations(ListOperationsRequest) returns (ListOperationsResponse) { + option (google.api.http) = { + get: "/v1/{name=operations}" + }; + option (google.api.method_signature) = "name,filter"; + } + + // 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. + rpc GetOperation(GetOperationRequest) returns (Operation) { + option (google.api.http) = { + get: "/v1/{name=operations/**}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a long-running operation. This method indicates that the client is + // no longer interested in the operation result. It does not cancel the + // operation. If the server doesn't support this method, it returns + // `google.rpc.Code.UNIMPLEMENTED`. + rpc DeleteOperation(DeleteOperationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=operations/**}" + }; + option (google.api.method_signature) = "name"; + } + + // Starts asynchronous cancellation on a long-running operation. The server + // makes a best effort to cancel the operation, but success is not + // guaranteed. If the server doesn't support this method, it returns + // `google.rpc.Code.UNIMPLEMENTED`. Clients can use + // [Operations.GetOperation][google.longrunning.Operations.GetOperation] or + // other methods to check whether the cancellation succeeded or whether the + // operation completed despite cancellation. On successful cancellation, + // the operation is not deleted; instead, it becomes an operation with + // an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + rpc CancelOperation(CancelOperationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/{name=operations/**}:cancel" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Waits until the specified long-running operation is done or reaches at most + // a specified timeout, returning the latest state. If the operation is + // already done, the latest state is immediately returned. If the timeout + // specified is greater than the default HTTP/RPC timeout, the HTTP/RPC + // timeout is used. If the server does not support this method, it returns + // `google.rpc.Code.UNIMPLEMENTED`. + // Note that this method is on a best-effort basis. It may return the latest + // state before the specified timeout (including immediately), meaning even an + // immediate response is no guarantee that the operation is done. + rpc WaitOperation(WaitOperationRequest) returns (Operation) { + } +} + +// This resource represents a long-running operation that is the result of a +// network API call. +message Operation { + // The server-assigned name, which is only unique within the same service that + // originally returns it. If you use the default HTTP mapping, the + // `name` should be a resource name ending with `operations/{unique_id}`. + string name = 1; + + // Service-specific metadata associated with the operation. It typically + // contains progress information and common metadata such as create time. + // Some services might not provide such metadata. Any method that returns a + // long-running operation should document the metadata type, if any. + google.protobuf.Any metadata = 2; + + // If the value is `false`, it means the operation is still in progress. + // If `true`, the operation is completed, and either `error` or `response` is + // available. + bool done = 3; + + // The operation result, which can be either an `error` or a valid `response`. + // If `done` == `false`, neither `error` nor `response` is set. + // If `done` == `true`, exactly one of `error` or `response` is set. + oneof result { + // The error result of the operation in case of failure or cancellation. + google.rpc.Status error = 4; + + // 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`. 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`, where `Xxx` + // is the original method name. For example, if the original method name + // is `TakeSnapshot()`, the inferred response type is + // `TakeSnapshotResponse`. + google.protobuf.Any response = 5; + } +} + +// The request message for [Operations.GetOperation][google.longrunning.Operations.GetOperation]. +message GetOperationRequest { + // The name of the operation resource. + string name = 1; +} + +// The request message for [Operations.ListOperations][google.longrunning.Operations.ListOperations]. +message ListOperationsRequest { + // The name of the operation's parent resource. + string name = 4; + + // The standard list filter. + string filter = 1; + + // The standard list page size. + int32 page_size = 2; + + // The standard list page token. + string page_token = 3; +} + +// The response message for [Operations.ListOperations][google.longrunning.Operations.ListOperations]. +message ListOperationsResponse { + // A list of operations that matches the specified filter in the request. + repeated Operation operations = 1; + + // The standard List next-page token. + string next_page_token = 2; +} + +// The request message for [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]. +message CancelOperationRequest { + // The name of the operation resource to be cancelled. + string name = 1; +} + +// The request message for [Operations.DeleteOperation][google.longrunning.Operations.DeleteOperation]. +message DeleteOperationRequest { + // The name of the operation resource to be deleted. + string name = 1; +} + +// The request message for [Operations.WaitOperation][google.longrunning.Operations.WaitOperation]. +message WaitOperationRequest { + // The name of the operation resource to wait on. + string name = 1; + + // The maximum duration to wait before timing out. If left blank, the wait + // will be at most the time permitted by the underlying HTTP/RPC protocol. + // If RPC context deadline is also specified, the shorter one will be used. + google.protobuf.Duration timeout = 2; +} + +// A message representing the message types used by a long-running operation. +// +// Example: +// +// rpc LongRunningRecognize(LongRunningRecognizeRequest) +// returns (google.longrunning.Operation) { +// option (google.longrunning.operation_info) = { +// response_type: "LongRunningRecognizeResponse" +// metadata_type: "LongRunningRecognizeMetadata" +// }; +// } +message OperationInfo { + // Required. The message name of the primary return type for this + // long-running operation. + // This type will be used to deserialize the LRO's response. + // + // If the response is in a different package from the rpc, a fully-qualified + // message name must be used (e.g. `google.protobuf.Struct`). + // + // Note: Altering this value constitutes a breaking change. + string response_type = 1; + + // Required. The message name of the metadata type for this long-running + // operation. + // + // If the response is in a different package from the rpc, a fully-qualified + // message name must be used (e.g. `google.protobuf.Struct`). + // + // Note: Altering this value constitutes a breaking change. + string metadata_type = 2; +} diff --git a/google/rpc/status.proto b/google/rpc/status.proto new file mode 100644 index 0000000..90b70dd --- /dev/null +++ b/google/rpc/status.proto @@ -0,0 +1,49 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.rpc; + +import "google/protobuf/any.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/rpc/status;status"; +option java_multiple_files = true; +option java_outer_classname = "StatusProto"; +option java_package = "com.google.rpc"; +option objc_class_prefix = "RPC"; + +// The `Status` type defines a logical error model that is suitable for +// different programming environments, including REST APIs and RPC APIs. It is +// used by [gRPC](https://github.com/grpc). Each `Status` message contains +// three pieces of data: error code, error message, and error details. +// +// You can find out more about this error model and how to work with it in the +// [API Design Guide](https://cloud.google.com/apis/design/errors). +message Status { + // The status code, which should be an enum value of + // [google.rpc.Code][google.rpc.Code]. + int32 code = 1; + + // A developer-facing error message, which should be in English. Any + // user-facing error message should be localized and sent in the + // [google.rpc.Status.details][google.rpc.Status.details] field, or localized + // by the client. + string message = 2; + + // A list of messages that carry the error details. There is a common set of + // message types for APIs to use. + repeated google.protobuf.Any details = 3; +} From b0862a376e781f276a852cf7c6f06cc062ba66e2 Mon Sep 17 00:00:00 2001 From: Rey DeLeon Date: Thu, 13 Jun 2024 10:07:08 -0600 Subject: [PATCH 2/8] remove google.longrunning nuget --- csharp/Ansys.Api.Additive.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/csharp/Ansys.Api.Additive.csproj b/csharp/Ansys.Api.Additive.csproj index d598876..050d469 100644 --- a/csharp/Ansys.Api.Additive.csproj +++ b/csharp/Ansys.Api.Additive.csproj @@ -14,7 +14,6 @@ - From b36d9f223813c65ef83480279415dff24abbeeb7 Mon Sep 17 00:00:00 2001 From: Rey DeLeon Date: Thu, 13 Jun 2024 10:13:43 -0600 Subject: [PATCH 3/8] bump version --- ansys/api/additive/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansys/api/additive/VERSION b/ansys/api/additive/VERSION index 1cb900d..2b215d2 100644 --- a/ansys/api/additive/VERSION +++ b/ansys/api/additive/VERSION @@ -1 +1 @@ -1.7.0-dev3 \ No newline at end of file +1.7.0-dev4 From 4ce470831b5ae68e71aa4d6b3041881b1fb1cfa2 Mon Sep 17 00:00:00 2001 From: Rey DeLeon Date: Thu, 13 Jun 2024 10:26:56 -0600 Subject: [PATCH 4/8] update README --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 648e40a..4dac426 100644 --- a/README.md +++ b/README.md @@ -73,3 +73,7 @@ To publicly release the packages, ensure your branch is up-to-date and then push git tag v0.5.0 git push --tags ``` + +#### Google protobuf files + +The Google third-party protobuf files were obtained from [googleapis](https://github.com/googleapis/googleapis). \ No newline at end of file From d4f54038c1480f71e808dc8194c8fc6f81ccfbe2 Mon Sep 17 00:00:00 2001 From: Rey DeLeon Date: Mon, 17 Jun 2024 11:31:01 -0600 Subject: [PATCH 5/8] Address comments --- ansys/api/additive/VERSION | 2 +- ansys/api/additive/v0/additive_domain.proto | 11 +++++++++++ ansys/api/additive/v0/additive_materials.proto | 8 +++++++- ansys/api/additive/v0/additive_simulation.proto | 17 +++++++---------- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/ansys/api/additive/VERSION b/ansys/api/additive/VERSION index 2b215d2..340db23 100644 --- a/ansys/api/additive/VERSION +++ b/ansys/api/additive/VERSION @@ -1 +1 @@ -1.7.0-dev4 +2.0.0-dev0 diff --git a/ansys/api/additive/v0/additive_domain.proto b/ansys/api/additive/v0/additive_domain.proto index 2cd4194..2beb5ee 100644 --- a/ansys/api/additive/v0/additive_domain.proto +++ b/ansys/api/additive/v0/additive_domain.proto @@ -4,6 +4,8 @@ package ansys.api.additive.v0; option csharp_namespace = "Ansys.Api.Additive"; +import "google/protobuf/timestamp.proto"; + // All units are assumed to be SI unless otherwise noted message MachineSettings { @@ -283,4 +285,13 @@ message Microstructure3DInput { message Microstructure3DResult { bytes three_d_vtk = 1; MicrostructureResult two_d_result = 2; +} + +message OperationMetadata { + google.protobuf.Timestamp CreateTime = 1; + google.protobuf.Timestamp EndTime = 2; + string simulationId = 3; + string context = 4; + string message = 5; + float percentComplete = 6; } \ No newline at end of file diff --git a/ansys/api/additive/v0/additive_materials.proto b/ansys/api/additive/v0/additive_materials.proto index 7675948..16aa289 100644 --- a/ansys/api/additive/v0/additive_materials.proto +++ b/ansys/api/additive/v0/additive_materials.proto @@ -6,6 +6,7 @@ package ansys.api.additive.v0.materials; option csharp_namespace = "Ansys.Api.Additive.Materials"; import "ansys/api/additive/v0/additive_domain.proto"; +import "google/longrunning/operations.proto"; import "google/protobuf/empty.proto"; service MaterialsService { @@ -14,7 +15,12 @@ service MaterialsService { rpc GetMaterial (GetMaterialRequest) returns (AdditiveMaterial); - rpc TuneMaterial (TuneMaterialRequest) returns (stream TuneMaterialResponse); + rpc TuneMaterial (TuneMaterialRequest) returns (google.longrunning.Operation) { + option (google.longrunning.operation_info) = { + response_type: "TuneMaterialResponse" + metadata_type: "OperationMetadata" + }; + } } message GetMaterialRequest { diff --git a/ansys/api/additive/v0/additive_simulation.proto b/ansys/api/additive/v0/additive_simulation.proto index 57ae2d4..cab3a2c 100644 --- a/ansys/api/additive/v0/additive_simulation.proto +++ b/ansys/api/additive/v0/additive_simulation.proto @@ -12,21 +12,18 @@ service SimulationService { rpc Simulate(SimulationRequest) returns (google.longrunning.Operation) { option (google.longrunning.operation_info) = { response_type: "SimulationResponse" + metadata_type: "OperationMetadata" }; } - rpc UploadFile(stream UploadFileRequest) returns (google.longrunning.Operation) { - option (google.longrunning.operation_info) = { - response_type: "UploadFileResponse" - }; - } - rpc DownloadFile(DownloadFileRequest) returns (google.longrunning.Operation) { - option (google.longrunning.operation_info) = { - response_type: "DownloadFileResponse" - }; - } + + rpc UploadFile(stream UploadFileRequest) returns (stream UploadFileResponse); + + rpc DownloadFile(DownloadFileRequest) returns (stream DownloadFileResponse); + rpc Mesh(MeshRequest) returns (google.longrunning.Operation) { option (google.longrunning.operation_info) = { response_type: "MeshResponse" + metadata_type: "OperationMetadata" }; } } From f79131779464a13df1cfa873608ea41cb7184ddd Mon Sep 17 00:00:00 2001 From: Rey DeLeon Date: Mon, 17 Jun 2024 11:37:29 -0600 Subject: [PATCH 6/8] Refactor op metadata --- ansys/api/additive/v0/additive_domain.proto | 11 ----------- .../api/additive/v0/additive_materials.proto | 1 + .../api/additive/v0/additive_operations.proto | 19 +++++++++++++++++++ .../api/additive/v0/additive_simulation.proto | 1 + 4 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 ansys/api/additive/v0/additive_operations.proto diff --git a/ansys/api/additive/v0/additive_domain.proto b/ansys/api/additive/v0/additive_domain.proto index 2beb5ee..2cd4194 100644 --- a/ansys/api/additive/v0/additive_domain.proto +++ b/ansys/api/additive/v0/additive_domain.proto @@ -4,8 +4,6 @@ package ansys.api.additive.v0; option csharp_namespace = "Ansys.Api.Additive"; -import "google/protobuf/timestamp.proto"; - // All units are assumed to be SI unless otherwise noted message MachineSettings { @@ -285,13 +283,4 @@ message Microstructure3DInput { message Microstructure3DResult { bytes three_d_vtk = 1; MicrostructureResult two_d_result = 2; -} - -message OperationMetadata { - google.protobuf.Timestamp CreateTime = 1; - google.protobuf.Timestamp EndTime = 2; - string simulationId = 3; - string context = 4; - string message = 5; - float percentComplete = 6; } \ No newline at end of file diff --git a/ansys/api/additive/v0/additive_materials.proto b/ansys/api/additive/v0/additive_materials.proto index 16aa289..6a394c7 100644 --- a/ansys/api/additive/v0/additive_materials.proto +++ b/ansys/api/additive/v0/additive_materials.proto @@ -6,6 +6,7 @@ package ansys.api.additive.v0.materials; option csharp_namespace = "Ansys.Api.Additive.Materials"; import "ansys/api/additive/v0/additive_domain.proto"; +import "ansys/api/additive/v0/additive_operations.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/empty.proto"; diff --git a/ansys/api/additive/v0/additive_operations.proto b/ansys/api/additive/v0/additive_operations.proto new file mode 100644 index 0000000..a7ef008 --- /dev/null +++ b/ansys/api/additive/v0/additive_operations.proto @@ -0,0 +1,19 @@ +// Copyright (c) 2024 ANSYS, Inc. + +syntax = "proto3"; + +package ansys.api.additive.v0; + +option csharp_namespace = "Ansys.Api.Additive"; + +import "google/protobuf/timestamp.proto"; + +// Metadata for a long running operation +message OperationMetadata { + google.protobuf.Timestamp CreateTime = 1; + google.protobuf.Timestamp EndTime = 2; + string simulationId = 3; + string context = 4; + string message = 5; + float percentComplete = 6; +} \ No newline at end of file diff --git a/ansys/api/additive/v0/additive_simulation.proto b/ansys/api/additive/v0/additive_simulation.proto index cab3a2c..3c73bef 100644 --- a/ansys/api/additive/v0/additive_simulation.proto +++ b/ansys/api/additive/v0/additive_simulation.proto @@ -6,6 +6,7 @@ package ansys.api.additive.v0.simulation; option csharp_namespace = "Ansys.Api.Additive.Simulation"; import "ansys/api/additive/v0/additive_domain.proto"; +import "ansys/api/additive/v0/additive_operations.proto"; import "google/longrunning/operations.proto"; service SimulationService { From 35b5ed2b3c77ff2d3df328d21917f4de4e2435a2 Mon Sep 17 00:00:00 2001 From: Rey DeLeon Date: Mon, 17 Jun 2024 11:39:11 -0600 Subject: [PATCH 7/8] Refactor op metadata --- ansys/api/additive/v0/additive_operations.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansys/api/additive/v0/additive_operations.proto b/ansys/api/additive/v0/additive_operations.proto index a7ef008..db4b169 100644 --- a/ansys/api/additive/v0/additive_operations.proto +++ b/ansys/api/additive/v0/additive_operations.proto @@ -16,4 +16,4 @@ message OperationMetadata { string context = 4; string message = 5; float percentComplete = 6; -} \ No newline at end of file +} From dd7dc100fb5c7376b5c33cbaebd674ef1272aee2 Mon Sep 17 00:00:00 2001 From: Rey DeLeon Date: Mon, 22 Jul 2024 16:47:04 -0600 Subject: [PATCH 8/8] Add progress state to OperationMetadata --- ansys/api/additive/v0/additive_materials.proto | 1 - ansys/api/additive/v0/additive_operations.proto | 2 ++ ansys/api/additive/v0/additive_simulation.proto | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ansys/api/additive/v0/additive_materials.proto b/ansys/api/additive/v0/additive_materials.proto index 29757b5..7c25697 100644 --- a/ansys/api/additive/v0/additive_materials.proto +++ b/ansys/api/additive/v0/additive_materials.proto @@ -6,7 +6,6 @@ package ansys.api.additive.v0.materials; option csharp_namespace = "Ansys.Api.Additive.Materials"; import "ansys/api/additive/v0/additive_domain.proto"; -import "ansys/api/additive/v0/additive_operations.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/empty.proto"; diff --git a/ansys/api/additive/v0/additive_operations.proto b/ansys/api/additive/v0/additive_operations.proto index d27e361..4b381e3 100644 --- a/ansys/api/additive/v0/additive_operations.proto +++ b/ansys/api/additive/v0/additive_operations.proto @@ -6,6 +6,7 @@ package ansys.api.additive.v0; option csharp_namespace = "Ansys.Api.Additive"; +import "ansys/api/additive/v0/additive_domain.proto"; import "google/protobuf/timestamp.proto"; // Metadata for a long running operation @@ -16,4 +17,5 @@ message OperationMetadata { string context = 4; string message = 5; float percent_complete = 6; + ProgressState state = 7; } diff --git a/ansys/api/additive/v0/additive_simulation.proto b/ansys/api/additive/v0/additive_simulation.proto index 3c73bef..cab3a2c 100644 --- a/ansys/api/additive/v0/additive_simulation.proto +++ b/ansys/api/additive/v0/additive_simulation.proto @@ -6,7 +6,6 @@ package ansys.api.additive.v0.simulation; option csharp_namespace = "Ansys.Api.Additive.Simulation"; import "ansys/api/additive/v0/additive_domain.proto"; -import "ansys/api/additive/v0/additive_operations.proto"; import "google/longrunning/operations.proto"; service SimulationService {