1// Copyright 2022 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.cloud.apigeeregistry.v1; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/longrunning/operations.proto"; 24import "google/protobuf/timestamp.proto"; 25 26option csharp_namespace = "Google.Cloud.ApigeeRegistry.V1"; 27option go_package = "cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb;apigeeregistrypb"; 28option java_multiple_files = true; 29option java_outer_classname = "ProvisioningServiceProto"; 30option java_package = "com.google.cloud.apigeeregistry.v1"; 31option php_namespace = "Google\\Cloud\\ApigeeRegistry\\V1"; 32option ruby_package = "Google::Cloud::ApigeeRegistry::V1"; 33 34// The service that is used for managing the data plane provisioning of the 35// Registry. 36service Provisioning { 37 option (google.api.default_host) = "apigeeregistry.googleapis.com"; 38 option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; 39 40 // Provisions instance resources for the Registry. 41 rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) { 42 option (google.api.http) = { 43 post: "/v1/{parent=projects/*/locations/*}/instances" 44 body: "instance" 45 }; 46 option (google.api.method_signature) = "parent,instance,instance_id"; 47 option (google.longrunning.operation_info) = { 48 response_type: "Instance" 49 metadata_type: "OperationMetadata" 50 }; 51 } 52 53 // Deletes the Registry instance. 54 rpc DeleteInstance(DeleteInstanceRequest) returns (google.longrunning.Operation) { 55 option (google.api.http) = { 56 delete: "/v1/{name=projects/*/locations/*/instances/*}" 57 }; 58 option (google.api.method_signature) = "name"; 59 option (google.longrunning.operation_info) = { 60 response_type: "google.protobuf.Empty" 61 metadata_type: "OperationMetadata" 62 }; 63 } 64 65 // Gets details of a single Instance. 66 rpc GetInstance(GetInstanceRequest) returns (Instance) { 67 option (google.api.http) = { 68 get: "/v1/{name=projects/*/locations/*/instances/*}" 69 }; 70 option (google.api.method_signature) = "name"; 71 } 72} 73 74// Request message for CreateInstance. 75message CreateInstanceRequest { 76 // Required. Parent resource of the Instance, of the form: `projects/*/locations/*` 77 string parent = 1 [ 78 (google.api.field_behavior) = REQUIRED, 79 (google.api.resource_reference) = { 80 type: "locations.googleapis.com/Location" 81 } 82 ]; 83 84 // Required. Identifier to assign to the Instance. Must be unique within scope of the 85 // parent resource. 86 string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; 87 88 // Required. The Instance. 89 Instance instance = 3 [(google.api.field_behavior) = REQUIRED]; 90} 91 92// Request message for DeleteInstance. 93message DeleteInstanceRequest { 94 // Required. The name of the Instance to delete. 95 // Format: `projects/*/locations/*/instances/*`. 96 string name = 1 [ 97 (google.api.field_behavior) = REQUIRED, 98 (google.api.resource_reference) = { 99 type: "apigeeregistry.googleapis.com/Instance" 100 } 101 ]; 102} 103 104// Request message for GetInstance. 105message GetInstanceRequest { 106 // Required. The name of the Instance to retrieve. 107 // Format: `projects/*/locations/*/instances/*`. 108 string name = 1 [ 109 (google.api.field_behavior) = REQUIRED, 110 (google.api.resource_reference) = { 111 type: "apigeeregistry.googleapis.com/Instance" 112 } 113 ]; 114} 115 116// Represents the metadata of the long-running operation. 117message OperationMetadata { 118 // The time the operation was created. 119 google.protobuf.Timestamp create_time = 1; 120 121 // The time the operation finished running. 122 google.protobuf.Timestamp end_time = 2; 123 124 // Server-defined resource path for the target of the operation. 125 string target = 3; 126 127 // Name of the verb executed by the operation. 128 string verb = 4; 129 130 // Human-readable status of the operation, if any. 131 string status_message = 5; 132 133 // Identifies whether the user has requested cancellation 134 // of the operation. Operations that have successfully been cancelled 135 // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, 136 // corresponding to `Code.CANCELLED`. 137 bool cancellation_requested = 6; 138 139 // API version used to start the operation. 140 string api_version = 7; 141} 142 143// An Instance represents the instance resources of the Registry. 144// Currently, only one instance is allowed for each project. 145message Instance { 146 option (google.api.resource) = { 147 type: "apigeeregistry.googleapis.com/Instance" 148 pattern: "projects/{project}/locations/{location}/instances/{instance}" 149 }; 150 151 // State of the Instance. 152 enum State { 153 // The default value. This value is used if the state is omitted. 154 STATE_UNSPECIFIED = 0; 155 156 // The Instance has not been initialized or has been deleted. 157 INACTIVE = 1; 158 159 // The Instance is being created. 160 CREATING = 2; 161 162 // The Instance has been created and is ready for use. 163 ACTIVE = 3; 164 165 // The Instance is being updated. 166 UPDATING = 4; 167 168 // The Instance is being deleted. 169 DELETING = 5; 170 171 // The Instance encountered an error during a state change. 172 FAILED = 6; 173 } 174 175 // Available configurations to provision an Instance. 176 message Config { 177 // Output only. The GCP location where the Instance resides. 178 string location = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; 179 180 // Required. The Customer Managed Encryption Key (CMEK) used for data encryption. 181 // The CMEK name should follow the format of 182 // `projects/([^/]+)/locations/([^/]+)/keyRings/([^/]+)/cryptoKeys/([^/]+)`, 183 // where the `location` must match InstanceConfig.location. 184 string cmek_key_name = 2 [(google.api.field_behavior) = REQUIRED]; 185 } 186 187 // Format: `projects/*/locations/*/instance`. 188 // Currently only `locations/global` is supported. 189 string name = 1; 190 191 // Output only. Creation timestamp. 192 google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; 193 194 // Output only. Last update timestamp. 195 google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; 196 197 // Output only. The current state of the Instance. 198 State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; 199 200 // Output only. Extra information of Instance.State if the state is `FAILED`. 201 string state_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; 202 203 // Required. Config of the Instance. 204 Config config = 6 [(google.api.field_behavior) = REQUIRED]; 205} 206