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.vpcaccess.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.VpcAccess.V1";
27option go_package = "cloud.google.com/go/vpcaccess/apiv1/vpcaccesspb;vpcaccesspb";
28option java_multiple_files = true;
29option java_outer_classname = "VpcAccessProto";
30option java_package = "com.google.cloud.vpcaccess.v1";
31option php_namespace = "Google\\Cloud\\VpcAccess\\V1";
32option ruby_package = "Google::Cloud::VpcAccess::V1";
33
34// Serverless VPC Access API allows users to create and manage connectors for
35// App Engine, Cloud Functions and Cloud Run to have internal connections to
36// Virtual Private Cloud networks.
37service VpcAccessService {
38  option (google.api.default_host) = "vpcaccess.googleapis.com";
39  option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
40
41  // Creates a Serverless VPC Access connector, returns an operation.
42  rpc CreateConnector(CreateConnectorRequest) returns (google.longrunning.Operation) {
43    option (google.api.http) = {
44      post: "/v1/{parent=projects/*/locations/*}/connectors"
45      body: "connector"
46    };
47    option (google.api.method_signature) = "parent,connector_id,connector";
48    option (google.longrunning.operation_info) = {
49      response_type: "Connector"
50      metadata_type: "OperationMetadata"
51    };
52  }
53
54  // Gets a Serverless VPC Access connector. Returns NOT_FOUND if the resource
55  // does not exist.
56  rpc GetConnector(GetConnectorRequest) returns (Connector) {
57    option (google.api.http) = {
58      get: "/v1/{name=projects/*/locations/*/connectors/*}"
59    };
60    option (google.api.method_signature) = "name";
61  }
62
63  // Lists Serverless VPC Access connectors.
64  rpc ListConnectors(ListConnectorsRequest) returns (ListConnectorsResponse) {
65    option (google.api.http) = {
66      get: "/v1/{parent=projects/*/locations/*}/connectors"
67    };
68    option (google.api.method_signature) = "parent";
69  }
70
71  // Deletes a Serverless VPC Access connector. Returns NOT_FOUND if the
72  // resource does not exist.
73  rpc DeleteConnector(DeleteConnectorRequest) returns (google.longrunning.Operation) {
74    option (google.api.http) = {
75      delete: "/v1/{name=projects/*/locations/*/connectors/*}"
76    };
77    option (google.api.method_signature) = "name";
78    option (google.longrunning.operation_info) = {
79      response_type: "google.protobuf.Empty"
80      metadata_type: "OperationMetadata"
81    };
82  }
83}
84
85// Definition of a Serverless VPC Access connector.
86message Connector {
87  option (google.api.resource) = {
88    type: "vpcaccess.googleapis.com/Connector"
89    pattern: "projects/{project}/locations/{location}/connectors/{connector}"
90  };
91
92  // State of a connector.
93  enum State {
94    // Invalid state.
95    STATE_UNSPECIFIED = 0;
96
97    // Connector is deployed and ready to receive traffic.
98    READY = 1;
99
100    // An Insert operation is in progress. Transient condition.
101    CREATING = 2;
102
103    // A Delete operation is in progress. Transient condition.
104    DELETING = 3;
105
106    // Connector is in a bad state, manual deletion recommended.
107    ERROR = 4;
108
109    // The connector is being updated.
110    UPDATING = 5;
111  }
112
113  // The subnet in which to house the connector
114  message Subnet {
115    // Subnet name (relative, not fully qualified).
116    // E.g. if the full subnet selfLink is
117    // https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks/{subnetName}
118    // the correct input for this field would be {subnetName}
119    string name = 1;
120
121    // Project in which the subnet exists.
122    // If not set, this project is assumed to be the project for which
123    // the connector create request was issued.
124    string project_id = 2;
125  }
126
127  // The resource name in the format `projects/*/locations/*/connectors/*`.
128  string name = 1;
129
130  // Name of a VPC network.
131  string network = 2;
132
133  // The range of internal addresses that follows RFC 4632 notation.
134  // Example: `10.132.0.0/28`.
135  string ip_cidr_range = 3;
136
137  // Output only. State of the VPC access connector.
138  State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
139
140  // Minimum throughput of the connector in Mbps. Default and min is 200.
141  int32 min_throughput = 5;
142
143  // Maximum throughput of the connector in Mbps. Default is 300, max is 1000.
144  int32 max_throughput = 6;
145
146  // Output only. List of projects using the connector.
147  repeated string connected_projects = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
148
149  // The subnet in which to house the VPC Access Connector.
150  Subnet subnet = 8;
151
152  // Machine type of VM Instance underlying connector. Default is e2-micro
153  string machine_type = 10;
154
155  // Minimum value of instances in autoscaling group underlying the connector.
156  int32 min_instances = 11;
157
158  // Maximum value of instances in autoscaling group underlying the connector.
159  int32 max_instances = 12;
160}
161
162// Request for creating a Serverless VPC Access connector.
163message CreateConnectorRequest {
164  // Required. The project and location in which the configuration should be created,
165  // specified in the format `projects/*/locations/*`.
166  string parent = 1 [
167    (google.api.field_behavior) = REQUIRED,
168    (google.api.resource_reference) = {
169      type: "locations.googleapis.com/Location"
170    }
171  ];
172
173  // Required. The ID to use for this connector.
174  string connector_id = 2 [(google.api.field_behavior) = REQUIRED];
175
176  // Required. Resource to create.
177  Connector connector = 3 [(google.api.field_behavior) = REQUIRED];
178}
179
180// Request for getting a Serverless VPC Access connector.
181message GetConnectorRequest {
182  // Required. Name of a Serverless VPC Access connector to get.
183  string name = 1 [
184    (google.api.field_behavior) = REQUIRED,
185    (google.api.resource_reference) = {
186      type: "vpcaccess.googleapis.com/Connector"
187    }
188  ];
189}
190
191// Request for listing Serverless VPC Access connectors in a location.
192message ListConnectorsRequest {
193  // Required. The project and location from which the routes should be listed.
194  string parent = 1 [
195    (google.api.field_behavior) = REQUIRED,
196    (google.api.resource_reference) = {
197      type: "locations.googleapis.com/Location"
198    }
199  ];
200
201  // Maximum number of functions to return per call.
202  int32 page_size = 2;
203
204  // Continuation token.
205  string page_token = 3;
206}
207
208// Response for listing Serverless VPC Access connectors.
209message ListConnectorsResponse {
210  // List of Serverless VPC Access connectors.
211  repeated Connector connectors = 1;
212
213  // Continuation token.
214  string next_page_token = 2;
215}
216
217// Request for deleting a Serverless VPC Access connector.
218message DeleteConnectorRequest {
219  // Required. Name of a Serverless VPC Access connector to delete.
220  string name = 1 [
221    (google.api.field_behavior) = REQUIRED,
222    (google.api.resource_reference) = {
223      type: "vpcaccess.googleapis.com/Connector"
224    }
225  ];
226}
227
228// Metadata for google.longrunning.Operation.
229message OperationMetadata {
230  // Output only. Method that initiated the operation e.g.
231  // google.cloud.vpcaccess.v1.Connectors.CreateConnector.
232  string method = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
233
234  // Output only. Time when the operation was created.
235  google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
236
237  // Output only. Time when the operation completed.
238  google.protobuf.Timestamp end_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
239
240  // Output only. Name of the resource that this operation is acting on e.g.
241  // projects/my-project/locations/us-central1/connectors/v1.
242  string target = 5 [
243    (google.api.field_behavior) = OUTPUT_ONLY,
244    (google.api.resource_reference) = {
245      type: "vpcaccess.googleapis.com/Connector"
246    }
247  ];
248}
249