diff --git a/packages/google-cloud-bigquery-connection/protos/google/cloud/bigquery/connection/v1/connection.proto b/packages/google-cloud-bigquery-connection/protos/google/cloud/bigquery/connection/v1/connection.proto index 1c316e3af70..ee0dba14ad8 100644 --- a/packages/google-cloud-bigquery-connection/protos/google/cloud/bigquery/connection/v1/connection.proto +++ b/packages/google-cloud-bigquery-connection/protos/google/cloud/bigquery/connection/v1/connection.proto @@ -233,6 +233,9 @@ message Connection { // Amazon Web Services (AWS) properties. AwsProperties aws = 8; + // Azure properties. + AzureProperties azure = 11; + // Cloud Spanner properties. CloudSpannerProperties cloud_spanner = 21; @@ -275,6 +278,13 @@ message CloudSqlProperties { // Input only. Cloud SQL credential. CloudSqlCredential credential = 4 [(google.api.field_behavior) = INPUT_ONLY]; + + // Output only. The account ID of the service used for the purpose of this connection. + // + // When the connection is used in the context of an operation in + // BigQuery, this service account will serve as identity being used for + // connecting to the CloudSQL instance specified in this connection. + string service_account_id = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; } // Credential info for the Cloud SQL. @@ -301,7 +311,8 @@ message AwsProperties { oneof authentication_method { // Authentication using Google owned AWS IAM user's access key to assume // into customer's AWS IAM Role. - AwsCrossAccountRole cross_account_role = 2; + // Deprecated, do not use. + AwsCrossAccountRole cross_account_role = 2 [deprecated = true]; // Authentication using Google owned service account to assume into // customer's AWS IAM Role. @@ -337,6 +348,34 @@ message AwsAccessRole { string identity = 2; } +// Container for connection properties specific to Azure. +message AzureProperties { + // Output only. The name of the Azure Active Directory Application. + string application = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The client id of the Azure Active Directory Application. + string client_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The object id of the Azure Active Directory Application. + string object_id = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The id of customer's directory that host the data. + string customer_tenant_id = 4; + + // The URL user will be redirected to after granting consent during connection + // setup. + string redirect_uri = 5; + + // The client id of the user's Azure Active Directory Application used for a + // federated connection. + string federated_application_client_id = 6; + + // Output only. A unique Google-owned and Google-generated identity for the Connection. + // This identity will be used to access the user's Azure Active Directory + // Application. + string identity = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + // Container for connection properties for delegation of access to GCP // resources. message CloudResourceProperties { diff --git a/packages/google-cloud-bigquery-connection/protos/protos.d.ts b/packages/google-cloud-bigquery-connection/protos/protos.d.ts index bd65a71c8c0..1e1bdaa2278 100644 --- a/packages/google-cloud-bigquery-connection/protos/protos.d.ts +++ b/packages/google-cloud-bigquery-connection/protos/protos.d.ts @@ -821,6 +821,9 @@ export namespace google { /** Connection aws */ aws?: (google.cloud.bigquery.connection.v1.IAwsProperties|null); + /** Connection azure */ + azure?: (google.cloud.bigquery.connection.v1.IAzureProperties|null); + /** Connection cloudSpanner */ cloudSpanner?: (google.cloud.bigquery.connection.v1.ICloudSpannerProperties|null); @@ -861,6 +864,9 @@ export namespace google { /** Connection aws. */ public aws?: (google.cloud.bigquery.connection.v1.IAwsProperties|null); + /** Connection azure. */ + public azure?: (google.cloud.bigquery.connection.v1.IAzureProperties|null); + /** Connection cloudSpanner. */ public cloudSpanner?: (google.cloud.bigquery.connection.v1.ICloudSpannerProperties|null); @@ -877,7 +883,7 @@ export namespace google { public hasCredential: boolean; /** Connection properties. */ - public properties?: ("cloudSql"|"aws"|"cloudSpanner"|"cloudResource"); + public properties?: ("cloudSql"|"aws"|"azure"|"cloudSpanner"|"cloudResource"); /** * Creates a new Connection instance using the specified properties. @@ -964,6 +970,9 @@ export namespace google { /** CloudSqlProperties credential */ credential?: (google.cloud.bigquery.connection.v1.ICloudSqlCredential|null); + + /** CloudSqlProperties serviceAccountId */ + serviceAccountId?: (string|null); } /** Represents a CloudSqlProperties. */ @@ -987,6 +996,9 @@ export namespace google { /** CloudSqlProperties credential. */ public credential?: (google.cloud.bigquery.connection.v1.ICloudSqlCredential|null); + /** CloudSqlProperties serviceAccountId. */ + public serviceAccountId: string; + /** * Creates a new CloudSqlProperties instance using the specified properties. * @param [properties] Properties to set @@ -1557,6 +1569,132 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of an AzureProperties. */ + interface IAzureProperties { + + /** AzureProperties application */ + application?: (string|null); + + /** AzureProperties clientId */ + clientId?: (string|null); + + /** AzureProperties objectId */ + objectId?: (string|null); + + /** AzureProperties customerTenantId */ + customerTenantId?: (string|null); + + /** AzureProperties redirectUri */ + redirectUri?: (string|null); + + /** AzureProperties federatedApplicationClientId */ + federatedApplicationClientId?: (string|null); + + /** AzureProperties identity */ + identity?: (string|null); + } + + /** Represents an AzureProperties. */ + class AzureProperties implements IAzureProperties { + + /** + * Constructs a new AzureProperties. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.bigquery.connection.v1.IAzureProperties); + + /** AzureProperties application. */ + public application: string; + + /** AzureProperties clientId. */ + public clientId: string; + + /** AzureProperties objectId. */ + public objectId: string; + + /** AzureProperties customerTenantId. */ + public customerTenantId: string; + + /** AzureProperties redirectUri. */ + public redirectUri: string; + + /** AzureProperties federatedApplicationClientId. */ + public federatedApplicationClientId: string; + + /** AzureProperties identity. */ + public identity: string; + + /** + * Creates a new AzureProperties instance using the specified properties. + * @param [properties] Properties to set + * @returns AzureProperties instance + */ + public static create(properties?: google.cloud.bigquery.connection.v1.IAzureProperties): google.cloud.bigquery.connection.v1.AzureProperties; + + /** + * Encodes the specified AzureProperties message. Does not implicitly {@link google.cloud.bigquery.connection.v1.AzureProperties.verify|verify} messages. + * @param message AzureProperties message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.bigquery.connection.v1.IAzureProperties, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AzureProperties message, length delimited. Does not implicitly {@link google.cloud.bigquery.connection.v1.AzureProperties.verify|verify} messages. + * @param message AzureProperties message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.bigquery.connection.v1.IAzureProperties, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AzureProperties message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AzureProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.bigquery.connection.v1.AzureProperties; + + /** + * Decodes an AzureProperties message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AzureProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.bigquery.connection.v1.AzureProperties; + + /** + * Verifies an AzureProperties message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AzureProperties message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AzureProperties + */ + public static fromObject(object: { [k: string]: any }): google.cloud.bigquery.connection.v1.AzureProperties; + + /** + * Creates a plain object from an AzureProperties message. Also converts values to other types if specified. + * @param message AzureProperties + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.bigquery.connection.v1.AzureProperties, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AzureProperties to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a CloudResourceProperties. */ interface ICloudResourceProperties { diff --git a/packages/google-cloud-bigquery-connection/protos/protos.js b/packages/google-cloud-bigquery-connection/protos/protos.js index cb7071ab5b1..e8f229c0752 100644 --- a/packages/google-cloud-bigquery-connection/protos/protos.js +++ b/packages/google-cloud-bigquery-connection/protos/protos.js @@ -1701,6 +1701,7 @@ * @property {string|null} [description] Connection description * @property {google.cloud.bigquery.connection.v1.ICloudSqlProperties|null} [cloudSql] Connection cloudSql * @property {google.cloud.bigquery.connection.v1.IAwsProperties|null} [aws] Connection aws + * @property {google.cloud.bigquery.connection.v1.IAzureProperties|null} [azure] Connection azure * @property {google.cloud.bigquery.connection.v1.ICloudSpannerProperties|null} [cloudSpanner] Connection cloudSpanner * @property {google.cloud.bigquery.connection.v1.ICloudResourceProperties|null} [cloudResource] Connection cloudResource * @property {number|Long|null} [creationTime] Connection creationTime @@ -1763,6 +1764,14 @@ */ Connection.prototype.aws = null; + /** + * Connection azure. + * @member {google.cloud.bigquery.connection.v1.IAzureProperties|null|undefined} azure + * @memberof google.cloud.bigquery.connection.v1.Connection + * @instance + */ + Connection.prototype.azure = null; + /** * Connection cloudSpanner. * @member {google.cloud.bigquery.connection.v1.ICloudSpannerProperties|null|undefined} cloudSpanner @@ -1808,12 +1817,12 @@ /** * Connection properties. - * @member {"cloudSql"|"aws"|"cloudSpanner"|"cloudResource"|undefined} properties + * @member {"cloudSql"|"aws"|"azure"|"cloudSpanner"|"cloudResource"|undefined} properties * @memberof google.cloud.bigquery.connection.v1.Connection * @instance */ Object.defineProperty(Connection.prototype, "properties", { - get: $util.oneOfGetter($oneOfFields = ["cloudSql", "aws", "cloudSpanner", "cloudResource"]), + get: $util.oneOfGetter($oneOfFields = ["cloudSql", "aws", "azure", "cloudSpanner", "cloudResource"]), set: $util.oneOfSetter($oneOfFields) }); @@ -1857,6 +1866,8 @@ writer.uint32(/* id 7, wireType 0 =*/56).bool(message.hasCredential); if (message.aws != null && Object.hasOwnProperty.call(message, "aws")) $root.google.cloud.bigquery.connection.v1.AwsProperties.encode(message.aws, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.azure != null && Object.hasOwnProperty.call(message, "azure")) + $root.google.cloud.bigquery.connection.v1.AzureProperties.encode(message.azure, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); if (message.cloudSpanner != null && Object.hasOwnProperty.call(message, "cloudSpanner")) $root.google.cloud.bigquery.connection.v1.CloudSpannerProperties.encode(message.cloudSpanner, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); if (message.cloudResource != null && Object.hasOwnProperty.call(message, "cloudResource")) @@ -1910,6 +1921,9 @@ case 8: message.aws = $root.google.cloud.bigquery.connection.v1.AwsProperties.decode(reader, reader.uint32()); break; + case 11: + message.azure = $root.google.cloud.bigquery.connection.v1.AzureProperties.decode(reader, reader.uint32()); + break; case 21: message.cloudSpanner = $root.google.cloud.bigquery.connection.v1.CloudSpannerProperties.decode(reader, reader.uint32()); break; @@ -1988,6 +2002,16 @@ return "aws." + error; } } + if (message.azure != null && message.hasOwnProperty("azure")) { + if (properties.properties === 1) + return "properties: multiple values"; + properties.properties = 1; + { + var error = $root.google.cloud.bigquery.connection.v1.AzureProperties.verify(message.azure); + if (error) + return "azure." + error; + } + } if (message.cloudSpanner != null && message.hasOwnProperty("cloudSpanner")) { if (properties.properties === 1) return "properties: multiple values"; @@ -2048,6 +2072,11 @@ throw TypeError(".google.cloud.bigquery.connection.v1.Connection.aws: object expected"); message.aws = $root.google.cloud.bigquery.connection.v1.AwsProperties.fromObject(object.aws); } + if (object.azure != null) { + if (typeof object.azure !== "object") + throw TypeError(".google.cloud.bigquery.connection.v1.Connection.azure: object expected"); + message.azure = $root.google.cloud.bigquery.connection.v1.AzureProperties.fromObject(object.azure); + } if (object.cloudSpanner != null) { if (typeof object.cloudSpanner !== "object") throw TypeError(".google.cloud.bigquery.connection.v1.Connection.cloudSpanner: object expected"); @@ -2138,6 +2167,11 @@ if (options.oneofs) object.properties = "aws"; } + if (message.azure != null && message.hasOwnProperty("azure")) { + object.azure = $root.google.cloud.bigquery.connection.v1.AzureProperties.toObject(message.azure, options); + if (options.oneofs) + object.properties = "azure"; + } if (message.cloudSpanner != null && message.hasOwnProperty("cloudSpanner")) { object.cloudSpanner = $root.google.cloud.bigquery.connection.v1.CloudSpannerProperties.toObject(message.cloudSpanner, options); if (options.oneofs) @@ -2175,6 +2209,7 @@ * @property {string|null} [database] CloudSqlProperties database * @property {google.cloud.bigquery.connection.v1.CloudSqlProperties.DatabaseType|null} [type] CloudSqlProperties type * @property {google.cloud.bigquery.connection.v1.ICloudSqlCredential|null} [credential] CloudSqlProperties credential + * @property {string|null} [serviceAccountId] CloudSqlProperties serviceAccountId */ /** @@ -2224,6 +2259,14 @@ */ CloudSqlProperties.prototype.credential = null; + /** + * CloudSqlProperties serviceAccountId. + * @member {string} serviceAccountId + * @memberof google.cloud.bigquery.connection.v1.CloudSqlProperties + * @instance + */ + CloudSqlProperties.prototype.serviceAccountId = ""; + /** * Creates a new CloudSqlProperties instance using the specified properties. * @function create @@ -2256,6 +2299,8 @@ writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); if (message.credential != null && Object.hasOwnProperty.call(message, "credential")) $root.google.cloud.bigquery.connection.v1.CloudSqlCredential.encode(message.credential, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.serviceAccountId != null && Object.hasOwnProperty.call(message, "serviceAccountId")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.serviceAccountId); return writer; }; @@ -2302,6 +2347,9 @@ case 4: message.credential = $root.google.cloud.bigquery.connection.v1.CloudSqlCredential.decode(reader, reader.uint32()); break; + case 5: + message.serviceAccountId = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -2357,6 +2405,9 @@ if (error) return "credential." + error; } + if (message.serviceAccountId != null && message.hasOwnProperty("serviceAccountId")) + if (!$util.isString(message.serviceAccountId)) + return "serviceAccountId: string expected"; return null; }; @@ -2395,6 +2446,8 @@ throw TypeError(".google.cloud.bigquery.connection.v1.CloudSqlProperties.credential: object expected"); message.credential = $root.google.cloud.bigquery.connection.v1.CloudSqlCredential.fromObject(object.credential); } + if (object.serviceAccountId != null) + message.serviceAccountId = String(object.serviceAccountId); return message; }; @@ -2416,6 +2469,7 @@ object.database = ""; object.type = options.enums === String ? "DATABASE_TYPE_UNSPECIFIED" : 0; object.credential = null; + object.serviceAccountId = ""; } if (message.instanceId != null && message.hasOwnProperty("instanceId")) object.instanceId = message.instanceId; @@ -2425,6 +2479,8 @@ object.type = options.enums === String ? $root.google.cloud.bigquery.connection.v1.CloudSqlProperties.DatabaseType[message.type] : message.type; if (message.credential != null && message.hasOwnProperty("credential")) object.credential = $root.google.cloud.bigquery.connection.v1.CloudSqlCredential.toObject(message.credential, options); + if (message.serviceAccountId != null && message.hasOwnProperty("serviceAccountId")) + object.serviceAccountId = message.serviceAccountId; return object; }; @@ -3565,6 +3621,326 @@ return AwsAccessRole; })(); + v1.AzureProperties = (function() { + + /** + * Properties of an AzureProperties. + * @memberof google.cloud.bigquery.connection.v1 + * @interface IAzureProperties + * @property {string|null} [application] AzureProperties application + * @property {string|null} [clientId] AzureProperties clientId + * @property {string|null} [objectId] AzureProperties objectId + * @property {string|null} [customerTenantId] AzureProperties customerTenantId + * @property {string|null} [redirectUri] AzureProperties redirectUri + * @property {string|null} [federatedApplicationClientId] AzureProperties federatedApplicationClientId + * @property {string|null} [identity] AzureProperties identity + */ + + /** + * Constructs a new AzureProperties. + * @memberof google.cloud.bigquery.connection.v1 + * @classdesc Represents an AzureProperties. + * @implements IAzureProperties + * @constructor + * @param {google.cloud.bigquery.connection.v1.IAzureProperties=} [properties] Properties to set + */ + function AzureProperties(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AzureProperties application. + * @member {string} application + * @memberof google.cloud.bigquery.connection.v1.AzureProperties + * @instance + */ + AzureProperties.prototype.application = ""; + + /** + * AzureProperties clientId. + * @member {string} clientId + * @memberof google.cloud.bigquery.connection.v1.AzureProperties + * @instance + */ + AzureProperties.prototype.clientId = ""; + + /** + * AzureProperties objectId. + * @member {string} objectId + * @memberof google.cloud.bigquery.connection.v1.AzureProperties + * @instance + */ + AzureProperties.prototype.objectId = ""; + + /** + * AzureProperties customerTenantId. + * @member {string} customerTenantId + * @memberof google.cloud.bigquery.connection.v1.AzureProperties + * @instance + */ + AzureProperties.prototype.customerTenantId = ""; + + /** + * AzureProperties redirectUri. + * @member {string} redirectUri + * @memberof google.cloud.bigquery.connection.v1.AzureProperties + * @instance + */ + AzureProperties.prototype.redirectUri = ""; + + /** + * AzureProperties federatedApplicationClientId. + * @member {string} federatedApplicationClientId + * @memberof google.cloud.bigquery.connection.v1.AzureProperties + * @instance + */ + AzureProperties.prototype.federatedApplicationClientId = ""; + + /** + * AzureProperties identity. + * @member {string} identity + * @memberof google.cloud.bigquery.connection.v1.AzureProperties + * @instance + */ + AzureProperties.prototype.identity = ""; + + /** + * Creates a new AzureProperties instance using the specified properties. + * @function create + * @memberof google.cloud.bigquery.connection.v1.AzureProperties + * @static + * @param {google.cloud.bigquery.connection.v1.IAzureProperties=} [properties] Properties to set + * @returns {google.cloud.bigquery.connection.v1.AzureProperties} AzureProperties instance + */ + AzureProperties.create = function create(properties) { + return new AzureProperties(properties); + }; + + /** + * Encodes the specified AzureProperties message. Does not implicitly {@link google.cloud.bigquery.connection.v1.AzureProperties.verify|verify} messages. + * @function encode + * @memberof google.cloud.bigquery.connection.v1.AzureProperties + * @static + * @param {google.cloud.bigquery.connection.v1.IAzureProperties} message AzureProperties message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AzureProperties.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.application != null && Object.hasOwnProperty.call(message, "application")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.application); + if (message.clientId != null && Object.hasOwnProperty.call(message, "clientId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.clientId); + if (message.objectId != null && Object.hasOwnProperty.call(message, "objectId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.objectId); + if (message.customerTenantId != null && Object.hasOwnProperty.call(message, "customerTenantId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.customerTenantId); + if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.redirectUri); + if (message.federatedApplicationClientId != null && Object.hasOwnProperty.call(message, "federatedApplicationClientId")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.federatedApplicationClientId); + if (message.identity != null && Object.hasOwnProperty.call(message, "identity")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.identity); + return writer; + }; + + /** + * Encodes the specified AzureProperties message, length delimited. Does not implicitly {@link google.cloud.bigquery.connection.v1.AzureProperties.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.bigquery.connection.v1.AzureProperties + * @static + * @param {google.cloud.bigquery.connection.v1.IAzureProperties} message AzureProperties message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AzureProperties.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AzureProperties message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.bigquery.connection.v1.AzureProperties + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.bigquery.connection.v1.AzureProperties} AzureProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AzureProperties.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.bigquery.connection.v1.AzureProperties(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.application = reader.string(); + break; + case 2: + message.clientId = reader.string(); + break; + case 3: + message.objectId = reader.string(); + break; + case 4: + message.customerTenantId = reader.string(); + break; + case 5: + message.redirectUri = reader.string(); + break; + case 6: + message.federatedApplicationClientId = reader.string(); + break; + case 7: + message.identity = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AzureProperties message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.bigquery.connection.v1.AzureProperties + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.bigquery.connection.v1.AzureProperties} AzureProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AzureProperties.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AzureProperties message. + * @function verify + * @memberof google.cloud.bigquery.connection.v1.AzureProperties + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AzureProperties.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.application != null && message.hasOwnProperty("application")) + if (!$util.isString(message.application)) + return "application: string expected"; + if (message.clientId != null && message.hasOwnProperty("clientId")) + if (!$util.isString(message.clientId)) + return "clientId: string expected"; + if (message.objectId != null && message.hasOwnProperty("objectId")) + if (!$util.isString(message.objectId)) + return "objectId: string expected"; + if (message.customerTenantId != null && message.hasOwnProperty("customerTenantId")) + if (!$util.isString(message.customerTenantId)) + return "customerTenantId: string expected"; + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + if (!$util.isString(message.redirectUri)) + return "redirectUri: string expected"; + if (message.federatedApplicationClientId != null && message.hasOwnProperty("federatedApplicationClientId")) + if (!$util.isString(message.federatedApplicationClientId)) + return "federatedApplicationClientId: string expected"; + if (message.identity != null && message.hasOwnProperty("identity")) + if (!$util.isString(message.identity)) + return "identity: string expected"; + return null; + }; + + /** + * Creates an AzureProperties message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.bigquery.connection.v1.AzureProperties + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.bigquery.connection.v1.AzureProperties} AzureProperties + */ + AzureProperties.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.bigquery.connection.v1.AzureProperties) + return object; + var message = new $root.google.cloud.bigquery.connection.v1.AzureProperties(); + if (object.application != null) + message.application = String(object.application); + if (object.clientId != null) + message.clientId = String(object.clientId); + if (object.objectId != null) + message.objectId = String(object.objectId); + if (object.customerTenantId != null) + message.customerTenantId = String(object.customerTenantId); + if (object.redirectUri != null) + message.redirectUri = String(object.redirectUri); + if (object.federatedApplicationClientId != null) + message.federatedApplicationClientId = String(object.federatedApplicationClientId); + if (object.identity != null) + message.identity = String(object.identity); + return message; + }; + + /** + * Creates a plain object from an AzureProperties message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.bigquery.connection.v1.AzureProperties + * @static + * @param {google.cloud.bigquery.connection.v1.AzureProperties} message AzureProperties + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AzureProperties.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.application = ""; + object.clientId = ""; + object.objectId = ""; + object.customerTenantId = ""; + object.redirectUri = ""; + object.federatedApplicationClientId = ""; + object.identity = ""; + } + if (message.application != null && message.hasOwnProperty("application")) + object.application = message.application; + if (message.clientId != null && message.hasOwnProperty("clientId")) + object.clientId = message.clientId; + if (message.objectId != null && message.hasOwnProperty("objectId")) + object.objectId = message.objectId; + if (message.customerTenantId != null && message.hasOwnProperty("customerTenantId")) + object.customerTenantId = message.customerTenantId; + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + object.redirectUri = message.redirectUri; + if (message.federatedApplicationClientId != null && message.hasOwnProperty("federatedApplicationClientId")) + object.federatedApplicationClientId = message.federatedApplicationClientId; + if (message.identity != null && message.hasOwnProperty("identity")) + object.identity = message.identity; + return object; + }; + + /** + * Converts this AzureProperties to JSON. + * @function toJSON + * @memberof google.cloud.bigquery.connection.v1.AzureProperties + * @instance + * @returns {Object.} JSON object + */ + AzureProperties.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AzureProperties; + })(); + v1.CloudResourceProperties = (function() { /** diff --git a/packages/google-cloud-bigquery-connection/protos/protos.json b/packages/google-cloud-bigquery-connection/protos/protos.json index e62ecac0666..db54f2aa682 100644 --- a/packages/google-cloud-bigquery-connection/protos/protos.json +++ b/packages/google-cloud-bigquery-connection/protos/protos.json @@ -301,6 +301,7 @@ "oneof": [ "cloudSql", "aws", + "azure", "cloudSpanner", "cloudResource" ] @@ -327,6 +328,10 @@ "type": "AwsProperties", "id": 8 }, + "azure": { + "type": "AzureProperties", + "id": 11 + }, "cloudSpanner": { "type": "CloudSpannerProperties", "id": 21 @@ -378,6 +383,13 @@ "options": { "(google.api.field_behavior)": "INPUT_ONLY" } + }, + "serviceAccountId": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } }, "nested": { @@ -426,7 +438,10 @@ "fields": { "crossAccountRole": { "type": "AwsCrossAccountRole", - "id": 2 + "id": 2, + "options": { + "deprecated": true + } }, "accessRole": { "type": "AwsAccessRole", @@ -468,6 +483,50 @@ } } }, + "AzureProperties": { + "fields": { + "application": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "clientId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "objectId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "customerTenantId": { + "type": "string", + "id": 4 + }, + "redirectUri": { + "type": "string", + "id": 5 + }, + "federatedApplicationClientId": { + "type": "string", + "id": 6 + }, + "identity": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, "CloudResourceProperties": { "fields": { "serviceAccountId": { diff --git a/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.create_connection.js b/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.create_connection.js index 6a163d840bc..8ac35d5fb73 100644 --- a/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.create_connection.js +++ b/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.create_connection.js @@ -23,6 +23,9 @@ function main(parent, connection) { // [START bigqueryconnection_v1_generated_ConnectionService_CreateConnection_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.delete_connection.js b/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.delete_connection.js index 6847bb3a423..43360021887 100644 --- a/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.delete_connection.js +++ b/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.delete_connection.js @@ -23,6 +23,9 @@ function main(name) { // [START bigqueryconnection_v1_generated_ConnectionService_DeleteConnection_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.get_connection.js b/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.get_connection.js index 7d206d2573b..406f86f5245 100644 --- a/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.get_connection.js +++ b/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.get_connection.js @@ -23,6 +23,9 @@ function main(name) { // [START bigqueryconnection_v1_generated_ConnectionService_GetConnection_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.get_iam_policy.js b/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.get_iam_policy.js index 1e50713dd73..cab48cb4d5f 100644 --- a/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.get_iam_policy.js +++ b/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.get_iam_policy.js @@ -23,6 +23,9 @@ function main(resource) { // [START bigqueryconnection_v1_generated_ConnectionService_GetIamPolicy_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.list_connections.js b/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.list_connections.js index 40bd87fd282..56f097f062c 100644 --- a/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.list_connections.js +++ b/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.list_connections.js @@ -23,6 +23,9 @@ function main(parent, pageSize) { // [START bigqueryconnection_v1_generated_ConnectionService_ListConnections_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.set_iam_policy.js b/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.set_iam_policy.js index 84ccdfb2a9a..6754edc5d4d 100644 --- a/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.set_iam_policy.js +++ b/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.set_iam_policy.js @@ -23,6 +23,9 @@ function main(resource, policy) { // [START bigqueryconnection_v1_generated_ConnectionService_SetIamPolicy_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.test_iam_permissions.js b/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.test_iam_permissions.js index 5d523c88d4e..985ddc86c48 100644 --- a/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.test_iam_permissions.js +++ b/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.test_iam_permissions.js @@ -23,6 +23,9 @@ function main(resource, permissions) { // [START bigqueryconnection_v1_generated_ConnectionService_TestIamPermissions_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.update_connection.js b/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.update_connection.js index f485ebe8200..59630d9b3c0 100644 --- a/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.update_connection.js +++ b/packages/google-cloud-bigquery-connection/samples/generated/v1/connection_service.update_connection.js @@ -23,6 +23,9 @@ function main(name, connection, updateMask) { // [START bigqueryconnection_v1_generated_ConnectionService_UpdateConnection_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-bigquery-connection/samples/generated/v1/snippet_metadata.google.cloud.bigquery.connection.v1.json b/packages/google-cloud-bigquery-connection/samples/generated/v1/snippet_metadata.google.cloud.bigquery.connection.v1.json index d507a052934..cf0737b4655 100644 --- a/packages/google-cloud-bigquery-connection/samples/generated/v1/snippet_metadata.google.cloud.bigquery.connection.v1.json +++ b/packages/google-cloud-bigquery-connection/samples/generated/v1/snippet_metadata.google.cloud.bigquery.connection.v1.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 60, + "end": 63, "type": "FULL" } ], @@ -70,7 +70,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -110,7 +110,7 @@ "segments": [ { "start": 25, - "end": 62, + "end": 65, "type": "FULL" } ], @@ -158,7 +158,7 @@ "segments": [ { "start": 25, - "end": 61, + "end": 64, "type": "FULL" } ], @@ -206,7 +206,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -246,7 +246,7 @@ "segments": [ { "start": 25, - "end": 56, + "end": 59, "type": "FULL" } ], @@ -290,7 +290,7 @@ "segments": [ { "start": 25, - "end": 66, + "end": 69, "type": "FULL" } ], @@ -338,7 +338,7 @@ "segments": [ { "start": 25, - "end": 59, + "end": 62, "type": "FULL" } ], diff --git a/packages/google-cloud-bigquery-connection/src/v1/connection_service_client.ts b/packages/google-cloud-bigquery-connection/src/v1/connection_service_client.ts index 177b90854b7..e2e4db59687 100644 --- a/packages/google-cloud-bigquery-connection/src/v1/connection_service_client.ts +++ b/packages/google-cloud-bigquery-connection/src/v1/connection_service_client.ts @@ -28,7 +28,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -261,7 +260,8 @@ export class ConnectionServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -1149,7 +1149,7 @@ export class ConnectionServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listConnections.createStream( - this.innerApiCalls.listConnections as gax.GaxCall, + this.innerApiCalls.listConnections as GaxCall, request, callSettings ); @@ -1198,7 +1198,7 @@ export class ConnectionServiceClient { this.initialize(); return this.descriptors.page.listConnections.asyncIterate( this.innerApiCalls['listConnections'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-bigquery-connection/test/gapic_connection_service_v1.ts b/packages/google-cloud-bigquery-connection/test/gapic_connection_service_v1.ts index c5ebcd130ca..ce69d131deb 100644 --- a/packages/google-cloud-bigquery-connection/test/gapic_connection_service_v1.ts +++ b/packages/google-cloud-bigquery-connection/test/gapic_connection_service_v1.ts @@ -113,101 +113,103 @@ function stubAsyncIterationCall( } describe('v1.ConnectionServiceClient', () => { - it('has servicePath', () => { - const servicePath = - connectionserviceModule.v1.ConnectionServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - connectionserviceModule.v1.ConnectionServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = connectionserviceModule.v1.ConnectionServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new connectionserviceModule.v1.ConnectionServiceClient(); - assert(client); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + connectionserviceModule.v1.ConnectionServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with gRPC fallback', () => { - const client = new connectionserviceModule.v1.ConnectionServiceClient({ - fallback: true, + it('has apiEndpoint', () => { + const apiEndpoint = + connectionserviceModule.v1.ConnectionServiceClient.apiEndpoint; + assert(apiEndpoint); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new connectionserviceModule.v1.ConnectionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has port', () => { + const port = connectionserviceModule.v1.ConnectionServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert.strictEqual(client.connectionServiceStub, undefined); - await client.initialize(); - assert(client.connectionServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new connectionserviceModule.v1.ConnectionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new connectionserviceModule.v1.ConnectionServiceClient(); + assert(client); }); - client.initialize(); - assert(client.connectionServiceStub); - client.close().then(() => { - done(); + + it('should create a client with gRPC fallback', () => { + const client = new connectionserviceModule.v1.ConnectionServiceClient({ + fallback: true, + }); + assert(client); }); - }); - it('has close method for the non-initialized client', done => { - const client = new connectionserviceModule.v1.ConnectionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has initialize method and supports deferred initialization', async () => { + const client = new connectionserviceModule.v1.ConnectionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.connectionServiceStub, undefined); + await client.initialize(); + assert(client.connectionServiceStub); }); - assert.strictEqual(client.connectionServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the initialized client', done => { + const client = new connectionserviceModule.v1.ConnectionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.connectionServiceStub); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new connectionserviceModule.v1.ConnectionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = new connectionserviceModule.v1.ConnectionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.connectionServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new connectionserviceModule.v1.ConnectionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new connectionserviceModule.v1.ConnectionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new connectionserviceModule.v1.ConnectionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('createConnection', () => {