xref: /aosp_15_r20/external/googleapis/google/cloud/alloydb/connectors/v1beta/resources.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 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.alloydb.connectors.v1beta;
18
19import "google/api/field_behavior.proto";
20
21option csharp_namespace = "Google.Cloud.AlloyDb.Connectors.V1Beta";
22option go_package = "cloud.google.com/go/alloydb/connectors/apiv1beta/connectorspb;connectorspb";
23option java_multiple_files = true;
24option java_outer_classname = "ResourcesProto";
25option java_package = "com.google.cloud.alloydb.connectors.v1beta";
26option php_namespace = "Google\\Cloud\\AlloyDb\\Connectors\\V1beta";
27option ruby_package = "Google::Cloud::AlloyDb::Connectors::V1beta";
28
29// Message used by AlloyDB connectors to exchange client and connection metadata
30// with the server after a successful TLS handshake. This metadata includes an
31// IAM token, which is used to authenticate users based on their IAM identity.
32// The sole purpose of this message is for the use of AlloyDB connectors.
33// Clients should not rely on this message directly as there can be breaking
34// changes in the future.
35message MetadataExchangeRequest {
36  // AuthType contains all supported authentication types.
37  enum AuthType {
38    // Authentication type is unspecified and DB_NATIVE is used by default
39    AUTH_TYPE_UNSPECIFIED = 0;
40
41    // Database native authentication (user/password)
42    DB_NATIVE = 1;
43
44    // Automatic IAM authentication
45    AUTO_IAM = 2;
46  }
47
48  // Optional. Connector information.
49  string user_agent = 1 [(google.api.field_behavior) = OPTIONAL];
50
51  // Authentication type.
52  AuthType auth_type = 2;
53
54  // IAM token used for both IAM user authentiation and
55  // `alloydb.instances.connect` permission check.
56  string oauth2_token = 3;
57}
58
59// Message for response to metadata exchange request. The sole purpose of this
60// message is for the use of AlloyDB connectors. Clients should not rely on this
61// message directly as there can be breaking changes in the future.
62message MetadataExchangeResponse {
63  // Response code.
64  enum ResponseCode {
65    // Unknown response code
66    RESPONSE_CODE_UNSPECIFIED = 0;
67
68    // Success
69    OK = 1;
70
71    // Failure
72    ERROR = 2;
73  }
74
75  // Response code.
76  ResponseCode response_code = 1;
77
78  // Optional. Error message.
79  string error = 2 [(google.api.field_behavior) = OPTIONAL];
80}
81