import * as gax from 'google-gax' ; import { Callback , CallOptions , Descriptors , ClientOptions , PaginationCallback , GaxCall , } 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' ) ; /**
 * Client JSON configuration object, loaded from
 * `src/v1/secret_manager_service_client_config.json`.
 * This file defines retry strategy and timeouts for all API methods in this library.
 */ import * as gapicConfig from './secret_manager_service_client_config.json' ; const version = require ( '../../../package.json' ) . version ; /**
 *  Secret Manager Service
 *
 *  Manages secrets and operations using those secrets. Implements a REST
 *  model with the following objects:
 *
 *  *  google . cloud . secretmanager . v1 . Secret *  *  google . cloud . secretmanager . v1 . SecretVersion class memberof export class SecretManagerServiceClient { private _terminated = false ; private _opts : ClientOptions ; private _providedCustomServicePath : boolean ; private _gaxModule : typeof gax | typeof gax . fallback ; private _gaxGrpc : gax . GrpcClient | gax . fallback . GrpcClient ; private _protos : { } ; private _defaults : { [ method ] : gax . CallSettings ; } ; auth : gax . GoogleAuth ; descriptors : Descriptors = { page : { } , stream : { } , longrunning : { } , batching : { } , } ; warn : ( code : string , message : string , warnType ? : string ) => void ; innerApiCalls : { [ name ] : Function ; } ; pathTemplates : { [ name ] : gax . PathTemplate ; } ; secretManagerServiceStub ? : Promise < { [ name ] : Function ; } > ; param options param options . credentials param { string } options . credentials . client_email param { string } options . credentials . private_key param { string } options . email param { string } options . keyFilename param { number } options . port param { string } options . projectId - The project ID from the Google
     *     Developer's Console, e.g. 'grape-spaceship-123'. We will also check
     *     the environment variable GCLOUD_PROJECT for your project ID. If your
     *     app is running in an environment which supports
     *      https ,
     *     your project ID will be detected automatically.
     *  param { string } options . apiEndpoint param { gax . ClientConfig } options . clientConfig - Client configuration override.
     *     Follows the structure of  gapicConfig .
     *  param { boolean } options . fallback constructor ( opts ? ) { const staticMembers = this . constructor as typeof SecretManagerServiceClient ; const servicePath = opts ?. servicePath || opts ?. apiEndpoint || staticMembers . servicePath ; this . _providedCustomServicePath = ! ! ( opts ?. servicePath || opts ?. apiEndpoint ) ; const port = opts ?. port || staticMembers . port ; const clientConfig = opts ?. clientConfig ?? { } ; const fallback = opts ?. fallback ?? ( typeof window !== 'undefined' && typeof window ?. fetch === 'function' ) ; opts = Object . assign ( { servicePath , port , clientConfig , fallback } , opts ) ; if ( servicePath !== staticMembers . servicePath && ! ( 'scopes' in opts ) ) { opts [ 'scopes' ] = staticMembers . scopes ; } this . _gaxModule = opts . fallback ? gax . fallback : gax ; this . _gaxGrpc = new this . _gaxModule . GrpcClient ( opts ) ; this . _opts = opts ; this . auth = this . _gaxGrpc . auth as gax . GoogleAuth ; this . auth . useJWTAccessWithScope = true ; this . auth . defaultServicePath = staticMembers . servicePath ; if ( servicePath === staticMembers . servicePath ) { this . auth . defaultScopes = staticMembers . scopes ; } const clientHeader = [ `gax/${ this . _gaxModule . version }` , `gapic/${ version }` ] ; if ( typeof process !== 'undefined' && 'versions' in process ) { clientHeader . push ( `gl-node/${ process . versions . node }` ) ; } else { clientHeader . push ( `gl-web/${ this . _gaxModule . version }` ) ; } if ( ! opts . fallback ) { clientHeader . push ( `grpc/${ this . _gaxGrpc . grpcVersion }` ) ; } else if ( opts . fallback === 'rest' ) { clientHeader . push ( `rest/${ this . _gaxGrpc . grpcVersion }` ) ; } if ( opts . libName && opts . libVersion ) { clientHeader . push ( `${ opts . libName }/${ opts . libVersion }` ) ; } this . _protos = this . _gaxGrpc . loadProtoJSON ( jsonProtos ) ; this . pathTemplates = { projectPathTemplate : new this . _gaxModule . PathTemplate ( 'projects/{project}' ) , secretPathTemplate : new this . _gaxModule . PathTemplate ( 'projects/{project}/secrets/{secret}' ) , secretVersionPathTemplate : new this . _gaxModule . PathTemplate ( 'projects/{project}/secrets/{secret}/versions/{secret_version}' ) , topicPathTemplate : new this . _gaxModule . PathTemplate ( 'projects/{project}/topics/{topic}' ) , } ; this . descriptors . page = { listSecrets : new this . _gaxModule . PageDescriptor ( 'pageToken' , 'nextPageToken' , 'secrets' ) , listSecretVersions : new this . _gaxModule . PageDescriptor ( 'pageToken' , 'nextPageToken' , 'versions' ) , } ; this . _defaults = this . _gaxGrpc . constructSettings ( 'google.cloud.secretmanager.v1.SecretManagerService' , gapicConfig as gax . ClientConfig , opts . clientConfig || { } , { 'x-goog-api-client' : clientHeader . join ( ' ' ) } ) ; this . innerApiCalls = { } ; this . warn = gax . warn ; } returns { Promise } initialize ( ) { if ( this . secretManagerServiceStub ) { return this . secretManagerServiceStub ; } this . secretManagerServiceStub = this . _gaxGrpc . createStub ( this . _opts . fallback ? ( this . _protos as protobuf . Root ) . lookupService ( 'google.cloud.secretmanager.v1.SecretManagerService' ) : ( this . _protos as any ) . google . cloud . secretmanager . v1 . SecretManagerService , this . _opts , this . _providedCustomServicePath ) as Promise < { [ method ] : Function ; } > ; const secretManagerServiceStubMethods = [ 'listSecrets' , 'createSecret' , 'addSecretVersion' , 'getSecret' , 'updateSecret' , 'deleteSecret' , 'listSecretVersions' , 'getSecretVersion' , 'accessSecretVersion' , 'disableSecretVersion' , 'enableSecretVersion' , 'destroySecretVersion' , 'setIamPolicy' , 'getIamPolicy' , 'testIamPermissions' , ] ; for ( const methodName of secretManagerServiceStubMethods ) { const callPromise = this . secretManagerServiceStub . then ( stub => ( ... args ) => { if ( this . _terminated ) { return Promise . reject ( 'The client has already been closed.' ) ; } const func = stub [ methodName ] ; return func . apply ( stub , args ) ; } , ( err ) => ( ) => { throw err ; } ) ; const descriptor = this . descriptors . page [ methodName ] || undefined ; const apiCall = this . _gaxModule . createApiCall ( callPromise , this . _defaults [ methodName ] , descriptor ) ; this . innerApiCalls [ methodName ] = apiCall ; } return this . secretManagerServiceStub ; } returns { string } static get servicePath ( ) { return 'secretmanager.googleapis.com' ; } returns { string } static get apiEndpoint ( ) { return 'secretmanager.googleapis.com' ; } returns { number } static get port ( ) { return 443 ; } returns { string [ ] } static get scopes ( ) { return [ 'https://www.googleapis.com/auth/cloud-platform' ] ; } getProjectId ( ) ; getProjectId ( callback ) ; returns { Promise } getProjectId ( callback ? ) { if ( callback ) { this . auth . getProjectId ( callback ) ; return ; } return this . auth . getProjectId ( ) ; } /**
     * Creates a new  google . cloud . secretmanager . v1 . Secret containing no  google . cloud . secretmanager . v1 . SecretVersion .
     *
     *  param request param { string } request . parent Required. The resource name of the project to associate with the
     *    google . cloud . secretmanager . v1 . Secret , in the format `projects/*`.
     *  param { string } request . secretId param { google . cloud . secretmanager . v1 . Secret } request . secret Required. A  google . cloud . secretmanager . v1 . Secret with initial field values.
     *  param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Secret] google . cloud . secretmanager . v1 . Secret .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example createSecret ( request ? , options ? ) ; createSecret ( request , options , callback ) ; createSecret ( request , callback ) ; createSecret ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { parent : request . parent || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . createSecret ( request , options , callback ) ; } /**
     * Creates a new  google . cloud . secretmanager . v1 . SecretVersion containing secret data and attaches
     * it to an existing  google . cloud . secretmanager . v1 . Secret .
     *
     *  param request param { string } request . parent Required. The resource name of the  google . cloud . secretmanager . v1 . Secret to associate with the
     *    google . cloud . secretmanager . v1 . SecretVersion in the format `projects/* /secrets/*`.
     *  param { google . cloud . secretmanager . v1 . SecretPayload } request . payload Required. The secret payload of the  google . cloud . secretmanager . v1 . SecretVersion .
     *  param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [SecretVersion] google . cloud . secretmanager . v1 . SecretVersion .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example addSecretVersion ( request ? , options ? ) ; addSecretVersion ( request , options , callback ) ; addSecretVersion ( request , callback ) ; addSecretVersion ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { parent : request . parent || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . addSecretVersion ( request , options , callback ) ; } /**
     * Gets metadata for a given  google . cloud . secretmanager . v1 . Secret .
     *
     *  param request param { string } request . name Required. The resource name of the  google . cloud . secretmanager . v1 . Secret , in the format `projects/* /secrets/*`.
     *  param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Secret] google . cloud . secretmanager . v1 . Secret .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example getSecret ( request ? , options ? ) ; getSecret ( request , options , callback ) ; getSecret ( request , callback ) ; getSecret ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { name : request . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . getSecret ( request , options , callback ) ; } /**
     * Updates metadata of an existing  google . cloud . secretmanager . v1 . Secret .
     *
     *  param request param { google . cloud . secretmanager . v1 . Secret } request . secret Required.  google . cloud . secretmanager . v1 . Secret with updated field values.
     *  param { google . protobuf . FieldMask } request . updateMask param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Secret] google . cloud . secretmanager . v1 . Secret .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example updateSecret ( request ? , options ? ) ; updateSecret ( request , options , callback ) ; updateSecret ( request , callback ) ; updateSecret ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { 'secret.name' : request . secret ! . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . updateSecret ( request , options , callback ) ; } /**
     * Deletes a  google . cloud . secretmanager . v1 . Secret .
     *
     *  param request param { string } request . name Required. The resource name of the  google . cloud . secretmanager . v1 . Secret to delete in the format
     *   `projects/* /secrets/*`.
     *  param { string } request . etag Optional. Etag of the  google . cloud . secretmanager . v1 . Secret . The request succeeds if it matches
     *   the etag of the currently stored secret object. If the etag is omitted,
     *   the request succeeds.
     *  param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Empty] google . protobuf . Empty .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example deleteSecret ( request ? , options ? ) ; deleteSecret ( request , options , callback ) ; deleteSecret ( request , callback ) ; deleteSecret ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { name : request . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . deleteSecret ( request , options , callback ) ; } /**
     * Gets metadata for a  google . cloud . secretmanager . v1 . SecretVersion .
     *
     * `projects/* /secrets/* /versions/latest` is an alias to the most recently
     * created  google . cloud . secretmanager . v1 . SecretVersion .
     *
     *  param request param { string } request . name Required. The resource name of the  google . cloud . secretmanager . v1 . SecretVersion in the format
     *   `projects/* /secrets/* /versions/*`.
     *
     *   `projects/* /secrets/* /versions/latest` is an alias to the most recently
     *   created  google . cloud . secretmanager . v1 . SecretVersion .
     *  param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [SecretVersion] google . cloud . secretmanager . v1 . SecretVersion .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example getSecretVersion ( request ? , options ? ) ; getSecretVersion ( request , options , callback ) ; getSecretVersion ( request , callback ) ; getSecretVersion ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { name : request . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . getSecretVersion ( request , options , callback ) ; } /**
     * Accesses a  google . cloud . secretmanager . v1 . SecretVersion . This call returns the secret data.
     *
     * `projects/* /secrets/* /versions/latest` is an alias to the most recently
     * created  google . cloud . secretmanager . v1 . SecretVersion .
     *
     *  param request param { string } request . name Required. The resource name of the  google . cloud . secretmanager . v1 . SecretVersion in the format
     *   `projects/* /secrets/* /versions/*`.
     *
     *   `projects/* /secrets/* /versions/latest` is an alias to the most recently
     *   created  google . cloud . secretmanager . v1 . SecretVersion .
     *  param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [AccessSecretVersionResponse] google . cloud . secretmanager . v1 . AccessSecretVersionResponse .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example accessSecretVersion ( request ? , options ? ) ; accessSecretVersion ( request , options , callback ) ; accessSecretVersion ( request , callback ) ; accessSecretVersion ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { name : request . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . accessSecretVersion ( request , options , callback ) ; } /**
     * Disables a  google . cloud . secretmanager . v1 . SecretVersion .
     *
     * Sets the  google . cloud . secretmanager . v1 . SecretVersion . state of the  google . cloud . secretmanager . v1 . SecretVersion to
     *  google . cloud . secretmanager . v1 . SecretVersion . State . DISABLED .
     *
     *  param request param { string } request . name Required. The resource name of the  google . cloud . secretmanager . v1 . SecretVersion to disable in the format
     *   `projects/* /secrets/* /versions/*`.
     *  param { string } request . etag Optional. Etag of the  google . cloud . secretmanager . v1 . SecretVersion . The request succeeds if it matches
     *   the etag of the currently stored secret version object. If the etag is
     *   omitted, the request succeeds.
     *  param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [SecretVersion] google . cloud . secretmanager . v1 . SecretVersion .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example disableSecretVersion ( request ? , options ? ) ; disableSecretVersion ( request , options , callback ) ; disableSecretVersion ( request , callback ) ; disableSecretVersion ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { name : request . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . disableSecretVersion ( request , options , callback ) ; } /**
     * Enables a  google . cloud . secretmanager . v1 . SecretVersion .
     *
     * Sets the  google . cloud . secretmanager . v1 . SecretVersion . state of the  google . cloud . secretmanager . v1 . SecretVersion to
     *  google . cloud . secretmanager . v1 . SecretVersion . State . ENABLED .
     *
     *  param request param { string } request . name Required. The resource name of the  google . cloud . secretmanager . v1 . SecretVersion to enable in the format
     *   `projects/* /secrets/* /versions/*`.
     *  param { string } request . etag Optional. Etag of the  google . cloud . secretmanager . v1 . SecretVersion . The request succeeds if it matches
     *   the etag of the currently stored secret version object. If the etag is
     *   omitted, the request succeeds.
     *  param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [SecretVersion] google . cloud . secretmanager . v1 . SecretVersion .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example enableSecretVersion ( request ? , options ? ) ; enableSecretVersion ( request , options , callback ) ; enableSecretVersion ( request , callback ) ; enableSecretVersion ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { name : request . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . enableSecretVersion ( request , options , callback ) ; } /**
     * Destroys a  google . cloud . secretmanager . v1 . SecretVersion .
     *
     * Sets the  google . cloud . secretmanager . v1 . SecretVersion . state of the  google . cloud . secretmanager . v1 . SecretVersion to
     *  google . cloud . secretmanager . v1 . SecretVersion . State . DESTROYED and irrevocably destroys the
     * secret data.
     *
     *  param request param { string } request . name Required. The resource name of the  google . cloud . secretmanager . v1 . SecretVersion to destroy in the format
     *   `projects/* /secrets/* /versions/*`.
     *  param { string } request . etag Optional. Etag of the  google . cloud . secretmanager . v1 . SecretVersion . The request succeeds if it matches
     *   the etag of the currently stored secret version object. If the etag is
     *   omitted, the request succeeds.
     *  param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [SecretVersion] google . cloud . secretmanager . v1 . SecretVersion .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example destroySecretVersion ( request ? , options ? ) ; destroySecretVersion ( request , options , callback ) ; destroySecretVersion ( request , callback ) ; destroySecretVersion ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { name : request . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . destroySecretVersion ( request , options , callback ) ; } /**
     * Sets the access control policy on the specified secret. Replaces any
     * existing policy.
     *
     * Permissions on  google . cloud . secretmanager . v1 . SecretVersion are enforced according
     * to the policy set on the associated  google . cloud . secretmanager . v1 . Secret .
     *
     *  param request param { string } request . resource param { google . iam . v1 . Policy } request . policy param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Policy] google . iam . v1 . Policy .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example setIamPolicy ( request ? , options ? ) ; setIamPolicy ( request , options , callback ) ; setIamPolicy ( request , callback ) ; setIamPolicy ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { resource : request . resource || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . setIamPolicy ( request , options , callback ) ; } param request param { string } request . resource param { google . iam . v1 . GetPolicyOptions } request . options param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Policy] google . iam . v1 . Policy .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example getIamPolicy ( request ? , options ? ) ; getIamPolicy ( request , options , callback ) ; getIamPolicy ( request , callback ) ; getIamPolicy ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { resource : request . resource || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . getIamPolicy ( request , options , callback ) ; } param request param { string } request . resource param { string [ ] } request . permissions param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [TestIamPermissionsResponse] google . iam . v1 . TestIamPermissionsResponse .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example testIamPermissions ( request ? , options ? ) ; testIamPermissions ( request , options , callback ) ; testIamPermissions ( request , callback ) ; testIamPermissions ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { resource : request . resource || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . testIamPermissions ( request , options , callback ) ; } /**
     * Lists  google . cloud . secretmanager . v1 . Secret .
     *
     *  param request param { string } request . parent Required. The resource name of the project associated with the
     *    google . cloud . secretmanager . v1 . Secret , in the format `projects/*`.
     *  param { number } request . pageSize param { string } request . pageToken Optional. Pagination token, returned earlier via
     *    google . cloud . secretmanager . v1 . ListSecretsResponse . next_page_token .
     *  param { string } request . filter param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is Array of [Secret] google . cloud . secretmanager . v1 . Secret .
     *   The client library will perform auto-pagination by default: it will call the API as many
     *   times as needed and will merge results from all the pages into this array.
     *   Note that it can affect your quota.
     *   We recommend using `listSecretsAsync()`
     *   method described below for async iteration which you can stop as needed.
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
     *   for more details and examples.
      listSecrets ( request ? , options ? ) ; listSecrets ( request , options , callback ) ; listSecrets ( request , callback ) ; listSecrets ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { parent : request . parent || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . listSecrets ( request , options , callback ) ; } param request param { string } request . parent Required. The resource name of the project associated with the
     *    google . cloud . secretmanager . v1 . Secret , in the format `projects/*`.
     *  param { number } request . pageSize param { string } request . pageToken Optional. Pagination token, returned earlier via
     *    google . cloud . secretmanager . v1 . ListSecretsResponse . next_page_token .
     *  param { string } request . filter param { object } options Call options. See  https for more details.
     *  returns { Stream } *   An object stream which emits an object representing [Secret] google . cloud . secretmanager . v1 . Secret on 'data' event.
     *   The client library will perform auto-pagination by default: it will call the API as many
     *   times as needed. Note that it can affect your quota.
     *   We recommend using `listSecretsAsync()`
     *   method described below for async iteration which you can stop as needed.
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
     *   for more details and examples.
      listSecretsStream ( request ? , options ? ) { request = request || { } ; options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { parent : request . parent || '' , } ) ; const defaultCallSettings = this . _defaults [ 'listSecrets' ] ; const callSettings = defaultCallSettings . merge ( options ) ; this . initialize ( ) ; return this . descriptors . page . listSecrets . createStream ( this . innerApiCalls . listSecrets as gax . GaxCall , request , callSettings ) ; } param request param { string } request . parent Required. The resource name of the project associated with the
     *    google . cloud . secretmanager . v1 . Secret , in the format `projects/*`.
     *  param { number } request . pageSize param { string } request . pageToken Optional. Pagination token, returned earlier via
     *    google . cloud . secretmanager . v1 . ListSecretsResponse . next_page_token .
     *  param { string } request . filter param { object } options Call options. See  https for more details.
     *  returns { Object } *   An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols).
     *   When you iterate the returned iterable, each element will be an object representing
     *   [Secret] google . cloud . secretmanager . v1 . Secret . The API will be called under the hood as needed, once per the page,
     *   so you can stop the iteration when you don't need more results.
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
     *   for more details and examples.
     *  example listSecretsAsync ( request ? , options ? ) { request = request || { } ; options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { parent : request . parent || '' , } ) ; const defaultCallSettings = this . _defaults [ 'listSecrets' ] ; const callSettings = defaultCallSettings . merge ( options ) ; this . initialize ( ) ; return this . descriptors . page . listSecrets . asyncIterate ( this . innerApiCalls [ 'listSecrets' ] as GaxCall , request as unknown as RequestType , callSettings ) as AsyncIterable < protos . google . cloud . secretmanager . v1 . ISecret > ; } /**
     * Lists  google . cloud . secretmanager . v1 . SecretVersion . This call does not return secret
     * data.
     *
     *  param request param { string } request . parent Required. The resource name of the  google . cloud . secretmanager . v1 . Secret associated with the
     *    google . cloud . secretmanager . v1 . SecretVersion to list, in the format
     *   `projects/* /secrets/*`.
     *  param { number } request . pageSize param { string } request . pageToken param { string } request . filter param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is Array of [SecretVersion] google . cloud . secretmanager . v1 . SecretVersion .
     *   The client library will perform auto-pagination by default: it will call the API as many
     *   times as needed and will merge results from all the pages into this array.
     *   Note that it can affect your quota.
     *   We recommend using `listSecretVersionsAsync()`
     *   method described below for async iteration which you can stop as needed.
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
     *   for more details and examples.
      listSecretVersions ( request ? , options ? ) ; listSecretVersions ( request , options , callback ) ; listSecretVersions ( request , callback ) ; listSecretVersions ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { parent : request . parent || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . listSecretVersions ( request , options , callback ) ; } param request param { string } request . parent Required. The resource name of the  google . cloud . secretmanager . v1 . Secret associated with the
     *    google . cloud . secretmanager . v1 . SecretVersion to list, in the format
     *   `projects/* /secrets/*`.
     *  param { number } request . pageSize param { string } request . pageToken param { string } request . filter param { object } options Call options. See  https for more details.
     *  returns { Stream } *   An object stream which emits an object representing [SecretVersion] google . cloud . secretmanager . v1 . SecretVersion on 'data' event.
     *   The client library will perform auto-pagination by default: it will call the API as many
     *   times as needed. Note that it can affect your quota.
     *   We recommend using `listSecretVersionsAsync()`
     *   method described below for async iteration which you can stop as needed.
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
     *   for more details and examples.
      listSecretVersionsStream ( request ? , options ? ) { request = request || { } ; options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { parent : request . parent || '' , } ) ; const defaultCallSettings = this . _defaults [ 'listSecretVersions' ] ; const callSettings = defaultCallSettings . merge ( options ) ; this . initialize ( ) ; return this . descriptors . page . listSecretVersions . createStream ( this . innerApiCalls . listSecretVersions as gax . GaxCall , request , callSettings ) ; } param request param { string } request . parent Required. The resource name of the  google . cloud . secretmanager . v1 . Secret associated with the
     *    google . cloud . secretmanager . v1 . SecretVersion to list, in the format
     *   `projects/* /secrets/*`.
     *  param { number } request . pageSize param { string } request . pageToken param { string } request . filter param { object } options Call options. See  https for more details.
     *  returns { Object } *   An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols).
     *   When you iterate the returned iterable, each element will be an object representing
     *   [SecretVersion] google . cloud . secretmanager . v1 . SecretVersion . The API will be called under the hood as needed, once per the page,
     *   so you can stop the iteration when you don't need more results.
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
     *   for more details and examples.
     *  example listSecretVersionsAsync ( request ? , options ? ) { request = request || { } ; options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { parent : request . parent || '' , } ) ; const defaultCallSettings = this . _defaults [ 'listSecretVersions' ] ; const callSettings = defaultCallSettings . merge ( options ) ; this . initialize ( ) ; return this . descriptors . page . listSecretVersions . asyncIterate ( this . innerApiCalls [ 'listSecretVersions' ] as GaxCall , request as unknown as RequestType , callSettings ) as AsyncIterable < protos . google . cloud . secretmanager . v1 . ISecretVersion > ; } param { string } project returns { string } projectPath ( project ) { return this . pathTemplates . projectPathTemplate . render ( { project : project , } ) ; } param { string } projectName returns { string } matchProjectFromProjectName ( projectName ) { return this . pathTemplates . projectPathTemplate . match ( projectName ) . project ; } param { string } project param { string } secret returns { string } secretPath ( project , secret ) { return this . pathTemplates . secretPathTemplate . render ( { project : project , secret : secret , } ) ; } param { string } secretName returns { string } matchProjectFromSecretName ( secretName ) { return this . pathTemplates . secretPathTemplate . match ( secretName ) . project ; } param { string } secretName returns { string } matchSecretFromSecretName ( secretName ) { return this . pathTemplates . secretPathTemplate . match ( secretName ) . secret ; } param { string } project param { string } secret param { string } secret_version returns { string } secretVersionPath ( project , secret , secretVersion ) { return this . pathTemplates . secretVersionPathTemplate . render ( { project : project , secret : secret , secret_version : secretVersion , } ) ; } param { string } secretVersionName returns { string } matchProjectFromSecretVersionName ( secretVersionName ) { return this . pathTemplates . secretVersionPathTemplate . match ( secretVersionName ) . project ; } param { string } secretVersionName returns { string } matchSecretFromSecretVersionName ( secretVersionName ) { return this . pathTemplates . secretVersionPathTemplate . match ( secretVersionName ) . secret ; } param { string } secretVersionName returns { string } matchSecretVersionFromSecretVersionName ( secretVersionName ) { return this . pathTemplates . secretVersionPathTemplate . match ( secretVersionName ) . secret_version ; } param { string } project param { string } topic returns { string } topicPath ( project , topic ) { return this . pathTemplates . topicPathTemplate . render ( { project : project , topic : topic , } ) ; } param { string } topicName returns { string } matchProjectFromTopicName ( topicName ) { return this . pathTemplates . topicPathTemplate . match ( topicName ) . project ; } param { string } topicName returns { string } matchTopicFromTopicName ( topicName ) { return this . pathTemplates . topicPathTemplate . match ( topicName ) . topic ; } returns { Promise } close ( ) { this . initialize ( ) ; if ( ! this . _terminated ) { return this . secretManagerServiceStub ! . then ( stub => { this . _terminated = true ; stub . close ( ) ; } ) ; } return Promise . resolve ( ) ; } }