Class v1.LicenseManagementServiceClient (0.6.2)

Service for managing licenses. v1

Package

@google-cloud/procurement

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of LicenseManagementServiceClient.

Parameters
Name Description
opts ClientOptions
gaxInstance typeof gax | typeof fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new LicenseManagementServiceClient({fallback: true}, gax); ```

Properties

apiEndpoint

get apiEndpoint(): string;

The DNS address for this API service.

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

licenseManagementServiceStub

licenseManagementServiceStub?: Promise<{
        [name: string]: Function;
    }>;

pathTemplates

pathTemplates: {
        [name: string]: gax.PathTemplate;
    };

port

static get port(): number;

The port for this API service.

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static get servicePath(): string;

The DNS address for this API service.

universeDomain

get universeDomain(): string;

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

assign(request, options)

assign(request?: protos.google.cloud.commerce.consumer.procurement.v1.IAssignRequest, options?: CallOptions): Promise<[
        protos.google.cloud.commerce.consumer.procurement.v1.IAssignResponse,
        (protos.google.cloud.commerce.consumer.procurement.v1.IAssignRequest | undefined),
        {} | undefined
    ]>;

Assigns a license to a user.

Parameters
Name Description
request IAssignRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.commerce.consumer.procurement.v1.IAssignResponse, (protos.google.cloud.commerce.consumer.procurement.v1.IAssignRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing AssignResponse. Please see the documentation for more details and examples.

Example

  /**
   * 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.
   */
  /**
   *  Required. License pool name.
   */
  // const parent = 'abc123'
  /**
   *  Required. Username.
   *  Format: `name@domain.com`.
   */
  // const usernames = ['abc','def']

  // Imports the Procurement library
  const {LicenseManagementServiceClient} = require('@google-cloud/procurement').v1;

  // Instantiates a client
  const procurementClient = new LicenseManagementServiceClient();

  async function callAssign() {
    // Construct request
    const request = {
      parent,
      usernames,
    };

    // Run request
    const response = await procurementClient.assign(request);
    console.log(response);
  }

  callAssign();

assign(request, options, callback)

assign(request: protos.google.cloud.commerce.consumer.procurement.v1.IAssignRequest, options: CallOptions, callback: Callback<protos.google.cloud.commerce.consumer.procurement.v1.IAssignResponse, protos.google.cloud.commerce.consumer.procurement.v1.IAssignRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IAssignRequest
options CallOptions
callback Callback<protos.google.cloud.commerce.consumer.procurement.v1.IAssignResponse, protos.google.cloud.commerce.consumer.procurement.v1.IAssignRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

assign(request, callback)

assign(request: protos.google.cloud.commerce.consumer.procurement.v1.IAssignRequest, callback: Callback<protos.google.cloud.commerce.consumer.procurement.v1.IAssignResponse, protos.google.cloud.commerce.consumer.procurement.v1.IAssignRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IAssignRequest
callback Callback<protos.google.cloud.commerce.consumer.procurement.v1.IAssignResponse, protos.google.cloud.commerce.consumer.procurement.v1.IAssignRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
Type Description
Promise<void>

{Promise} A promise that resolves when the client is closed.

enumerateLicensedUsers(request, options)

enumerateLicensedUsers(request?: protos.google.cloud.commerce.consumer.procurement.v1.IEnumerateLicensedUsersRequest, options?: CallOptions): Promise<[
        protos.google.cloud.commerce.consumer.procurement.v1.ILicensedUser[],
        protos.google.cloud.commerce.consumer.procurement.v1.IEnumerateLicensedUsersRequest | null,
        protos.google.cloud.commerce.consumer.procurement.v1.IEnumerateLicensedUsersResponse
    ]>;

Enumerates all users assigned a license.

Parameters
Name Description
request IEnumerateLicensedUsersRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.commerce.consumer.procurement.v1.ILicensedUser[], protos.google.cloud.commerce.consumer.procurement.v1.IEnumerateLicensedUsersRequest | null, protos.google.cloud.commerce.consumer.procurement.v1.IEnumerateLicensedUsersResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of LicensedUser. 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 enumerateLicensedUsersAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

enumerateLicensedUsers(request, options, callback)

enumerateLicensedUsers(request: protos.google.cloud.commerce.consumer.procurement.v1.IEnumerateLicensedUsersRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.commerce.consumer.procurement.v1.IEnumerateLicensedUsersRequest, protos.google.cloud.commerce.consumer.procurement.v1.IEnumerateLicensedUsersResponse | null | undefined, protos.google.cloud.commerce.consumer.procurement.v1.ILicensedUser>): void;
Parameters
Name Description
request IEnumerateLicensedUsersRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.commerce.consumer.procurement.v1.IEnumerateLicensedUsersRequest, protos.google.cloud.commerce.consumer.procurement.v1.IEnumerateLicensedUsersResponse | null | undefined, protos.google.cloud.commerce.consumer.procurement.v1.ILicensedUser>
Returns
Type Description
void

enumerateLicensedUsers(request, callback)

enumerateLicensedUsers(request: protos.google.cloud.commerce.consumer.procurement.v1.IEnumerateLicensedUsersRequest, callback: PaginationCallback<protos.google.cloud.commerce.consumer.procurement.v1.IEnumerateLicensedUsersRequest, protos.google.cloud.commerce.consumer.procurement.v1.IEnumerateLicensedUsersResponse | null | undefined, protos.google.cloud.commerce.consumer.procurement.v1.ILicensedUser>): void;
Parameters
Name Description
request IEnumerateLicensedUsersRequest
callback PaginationCallback<protos.google.cloud.commerce.consumer.procurement.v1.IEnumerateLicensedUsersRequest, protos.google.cloud.commerce.consumer.procurement.v1.IEnumerateLicensedUsersResponse | null | undefined, protos.google.cloud.commerce.consumer.procurement.v1.ILicensedUser>
Returns
Type Description
void

enumerateLicensedUsersAsync(request, options)

enumerateLicensedUsersAsync(request?: protos.google.cloud.commerce.consumer.procurement.v1.IEnumerateLicensedUsersRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.commerce.consumer.procurement.v1.ILicensedUser>;

Equivalent to enumerateLicensedUsers, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request IEnumerateLicensedUsersRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.commerce.consumer.procurement.v1.ILicensedUser>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing LicensedUser. 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 for more details and examples.

Example

  /**
   * 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.
   */
  /**
   *  Required. License pool name.
   */
  // const parent = 'abc123'
  /**
   *  Optional. The maximum number of users to return. The service may return
   *  fewer than this value.
   */
  // const pageSize = 1234
  /**
   *  Optional. A page token, received from a previous `EnumerateLicensedUsers`
   *  call. Provide this to retrieve the subsequent page.
   */
  // const pageToken = 'abc123'

  // Imports the Procurement library
  const {LicenseManagementServiceClient} = require('@google-cloud/procurement').v1;

  // Instantiates a client
  const procurementClient = new LicenseManagementServiceClient();

  async function callEnumerateLicensedUsers() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = procurementClient.enumerateLicensedUsersAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callEnumerateLicensedUsers();

enumerateLicensedUsersStream(request, options)

enumerateLicensedUsersStream(request?: protos.google.cloud.commerce.consumer.procurement.v1.IEnumerateLicensedUsersRequest, options?: CallOptions): Transform;

Equivalent to enumerateLicensedUsers, but returns a NodeJS Stream object.

Parameters
Name Description
request IEnumerateLicensedUsersRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing LicensedUser 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 enumerateLicensedUsersAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

getLicensePool(request, options)

getLicensePool(request?: protos.google.cloud.commerce.consumer.procurement.v1.IGetLicensePoolRequest, options?: CallOptions): Promise<[
        protos.google.cloud.commerce.consumer.procurement.v1.ILicensePool,
        (protos.google.cloud.commerce.consumer.procurement.v1.IGetLicensePoolRequest | undefined),
        {} | undefined
    ]>;

Gets the license pool.

Parameters
Name Description
request IGetLicensePoolRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.commerce.consumer.procurement.v1.ILicensePool, (protos.google.cloud.commerce.consumer.procurement.v1.IGetLicensePoolRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing LicensePool. Please see the documentation for more details and examples.

Example

  /**
   * 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.
   */
  /**
   *  Required. The name of the license pool to get.
   *  Format: `billingAccounts/{billing_account}/orders/{order}/licensePool`
   */
  // const name = 'abc123'

  // Imports the Procurement library
  const {LicenseManagementServiceClient} = require('@google-cloud/procurement').v1;

  // Instantiates a client
  const procurementClient = new LicenseManagementServiceClient();

  async function callGetLicensePool() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await procurementClient.getLicensePool(request);
    console.log(response);
  }

  callGetLicensePool();

getLicensePool(request, options, callback)

getLicensePool(request: protos.google.cloud.commerce.consumer.procurement.v1.IGetLicensePoolRequest, options: CallOptions, callback: Callback<protos.google.cloud.commerce.consumer.procurement.v1.ILicensePool, protos.google.cloud.commerce.consumer.procurement.v1.IGetLicensePoolRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetLicensePoolRequest
options CallOptions
callback Callback<protos.google.cloud.commerce.consumer.procurement.v1.ILicensePool, protos.google.cloud.commerce.consumer.procurement.v1.IGetLicensePoolRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getLicensePool(request, callback)

getLicensePool(request: protos.google.cloud.commerce.consumer.procurement.v1.IGetLicensePoolRequest, callback: Callback<protos.google.cloud.commerce.consumer.procurement.v1.ILicensePool, protos.google.cloud.commerce.consumer.procurement.v1.IGetLicensePoolRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetLicensePoolRequest
callback Callback<protos.google.cloud.commerce.consumer.procurement.v1.ILicensePool, protos.google.cloud.commerce.consumer.procurement.v1.IGetLicensePoolRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getProjectId()

getProjectId(): Promise<string>;
Returns
Type Description
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
Name Description
callback Callback<string, undefined, undefined>
Returns
Type Description
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
Type Description
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

licensePoolPath(billingAccount, order)

licensePoolPath(billingAccount: string, order: string): string;

Return a fully-qualified licensePool resource name string.

Parameters
Name Description
billingAccount string
order string
Returns
Type Description
string

{string} Resource name string.

matchBillingAccountFromLicensePoolName(licensePoolName)

matchBillingAccountFromLicensePoolName(licensePoolName: string): string | number;

Parse the billing_account from LicensePool resource.

Parameter
Name Description
licensePoolName string

A fully-qualified path representing LicensePool resource.

Returns
Type Description
string | number

{string} A string representing the billing_account.

matchBillingAccountFromOrderName(orderName)

matchBillingAccountFromOrderName(orderName: string): string | number;

Parse the billing_account from Order resource.

Parameter
Name Description
orderName string

A fully-qualified path representing Order resource.

Returns
Type Description
string | number

{string} A string representing the billing_account.

matchOrderFromLicensePoolName(licensePoolName)

matchOrderFromLicensePoolName(licensePoolName: string): string | number;

Parse the order from LicensePool resource.

Parameter
Name Description
licensePoolName string

A fully-qualified path representing LicensePool resource.

Returns
Type Description
string | number

{string} A string representing the order.

matchOrderFromOrderName(orderName)

matchOrderFromOrderName(orderName: string): string | number;

Parse the order from Order resource.

Parameter
Name Description
orderName string

A fully-qualified path representing Order resource.

Returns
Type Description
string | number

{string} A string representing the order.

orderPath(billingAccount, order)

orderPath(billingAccount: string, order: string): string;

Return a fully-qualified order resource name string.

Parameters
Name Description
billingAccount string
order string
Returns
Type Description
string

{string} Resource name string.

unassign(request, options)

unassign(request?: protos.google.cloud.commerce.consumer.procurement.v1.IUnassignRequest, options?: CallOptions): Promise<[
        protos.google.cloud.commerce.consumer.procurement.v1.IUnassignResponse,
        (protos.google.cloud.commerce.consumer.procurement.v1.IUnassignRequest | undefined),
        {} | undefined
    ]>;

Unassigns a license from a user.

Parameters
Name Description
request IUnassignRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.commerce.consumer.procurement.v1.IUnassignResponse, (protos.google.cloud.commerce.consumer.procurement.v1.IUnassignRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing UnassignResponse. Please see the documentation for more details and examples.

Example

  /**
   * 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.
   */
  /**
   *  Required. License pool name.
   */
  // const parent = 'abc123'
  /**
   *  Required. Username.
   *  Format: `name@domain.com`.
   */
  // const usernames = ['abc','def']

  // Imports the Procurement library
  const {LicenseManagementServiceClient} = require('@google-cloud/procurement').v1;

  // Instantiates a client
  const procurementClient = new LicenseManagementServiceClient();

  async function callUnassign() {
    // Construct request
    const request = {
      parent,
      usernames,
    };

    // Run request
    const response = await procurementClient.unassign(request);
    console.log(response);
  }

  callUnassign();

unassign(request, options, callback)

unassign(request: protos.google.cloud.commerce.consumer.procurement.v1.IUnassignRequest, options: CallOptions, callback: Callback<protos.google.cloud.commerce.consumer.procurement.v1.IUnassignResponse, protos.google.cloud.commerce.consumer.procurement.v1.IUnassignRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUnassignRequest
options CallOptions
callback Callback<protos.google.cloud.commerce.consumer.procurement.v1.IUnassignResponse, protos.google.cloud.commerce.consumer.procurement.v1.IUnassignRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

unassign(request, callback)

unassign(request: protos.google.cloud.commerce.consumer.procurement.v1.IUnassignRequest, callback: Callback<protos.google.cloud.commerce.consumer.procurement.v1.IUnassignResponse, protos.google.cloud.commerce.consumer.procurement.v1.IUnassignRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUnassignRequest
callback Callback<protos.google.cloud.commerce.consumer.procurement.v1.IUnassignResponse, protos.google.cloud.commerce.consumer.procurement.v1.IUnassignRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateLicensePool(request, options)

updateLicensePool(request?: protos.google.cloud.commerce.consumer.procurement.v1.IUpdateLicensePoolRequest, options?: CallOptions): Promise<[
        protos.google.cloud.commerce.consumer.procurement.v1.ILicensePool,
        (protos.google.cloud.commerce.consumer.procurement.v1.IUpdateLicensePoolRequest | undefined),
        {} | undefined
    ]>;

Updates the license pool if one exists for this Order.

Parameters
Name Description
request IUpdateLicensePoolRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.commerce.consumer.procurement.v1.ILicensePool, (protos.google.cloud.commerce.consumer.procurement.v1.IUpdateLicensePoolRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing LicensePool. Please see the documentation for more details and examples.

Example

  /**
   * 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.
   */
  /**
   *  Required. The license pool to update.
   *  The license pool's name field is used to identify the license pool to
   *  update. Format:
   *  `billingAccounts/{billing_account}/orders/{order}/licensePool`.
   */
  // const licensePool = {}
  /**
   *  Required. The list of fields to update.
   */
  // const updateMask = {}

  // Imports the Procurement library
  const {LicenseManagementServiceClient} = require('@google-cloud/procurement').v1;

  // Instantiates a client
  const procurementClient = new LicenseManagementServiceClient();

  async function callUpdateLicensePool() {
    // Construct request
    const request = {
      licensePool,
      updateMask,
    };

    // Run request
    const response = await procurementClient.updateLicensePool(request);
    console.log(response);
  }

  callUpdateLicensePool();

updateLicensePool(request, options, callback)

updateLicensePool(request: protos.google.cloud.commerce.consumer.procurement.v1.IUpdateLicensePoolRequest, options: CallOptions, callback: Callback<protos.google.cloud.commerce.consumer.procurement.v1.ILicensePool, protos.google.cloud.commerce.consumer.procurement.v1.IUpdateLicensePoolRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateLicensePoolRequest
options CallOptions
callback Callback<protos.google.cloud.commerce.consumer.procurement.v1.ILicensePool, protos.google.cloud.commerce.consumer.procurement.v1.IUpdateLicensePoolRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateLicensePool(request, callback)

updateLicensePool(request: protos.google.cloud.commerce.consumer.procurement.v1.IUpdateLicensePoolRequest, callback: Callback<protos.google.cloud.commerce.consumer.procurement.v1.ILicensePool, protos.google.cloud.commerce.consumer.procurement.v1.IUpdateLicensePoolRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateLicensePoolRequest
callback Callback<protos.google.cloud.commerce.consumer.procurement.v1.ILicensePool, protos.google.cloud.commerce.consumer.procurement.v1.IUpdateLicensePoolRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void