Class v1.ResourceSettingsServiceClient

An interface to interact with resource settings and setting values throughout the resource hierarchy.

Services may surface a number of settings for users to control how their resources behave. Values of settings applied on a given Cloud resource are evaluated hierarchically and inherited by all descendants of that resource.

For all requests, returns a google.rpc.Status with google.rpc.Code.PERMISSION_DENIED if the IAM check fails or the parent resource is not in a Cloud Organization. For all requests, returns a google.rpc.Status with google.rpc.Code.INVALID_ARGUMENT if the request is malformed. v1

Package

@google-cloud/resource-settings

Constructors

(constructor)(opts)

constructor(opts?: ClientOptions);

Construct an instance of ResourceSettingsServiceClient.

Parameter
NameDescription
opts ClientOptions

Properties

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

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

pathTemplates

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

port

static get port(): number;

The port for this API service.

resourceSettingsServiceStub

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

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.

warn

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

Methods

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
TypeDescription
Promise<void>

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

folderSettingNamePath(folder, settingName)

folderSettingNamePath(folder: string, settingName: string): string;

Return a fully-qualified folderSettingName resource name string.

Parameters
NameDescription
folder string
settingName string
Returns
TypeDescription
string

{string} Resource name string.

getProjectId()

getProjectId(): Promise<string>;
Returns
TypeDescription
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
NameDescription
callback Callback<string, undefined, undefined>
Returns
TypeDescription
void

getSetting(request, options)

getSetting(request?: protos.google.cloud.resourcesettings.v1.IGetSettingRequest, options?: CallOptions): Promise<[
        protos.google.cloud.resourcesettings.v1.ISetting,
        protos.google.cloud.resourcesettings.v1.IGetSettingRequest | undefined,
        {} | undefined
    ]>;

Gets a setting.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the setting does not exist.

Parameters
NameDescription
request protos.google.cloud.resourcesettings.v1.IGetSettingRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.resourcesettings.v1.ISetting, protos.google.cloud.resourcesettings.v1.IGetSettingRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Setting]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the setting to get. See Setting google.cloud.resourcesettings.v1.Setting  for naming
   *  requirements.
   */
  // const name = 'abc123'
  /**
   *  The SettingView for this request.
   */
  // const view = {}

  // Imports the Resourcesettings library
  const {ResourceSettingsServiceClient} =
    require('@google-cloud/resource-settings').v1;

  // Instantiates a client
  const resourcesettingsClient = new ResourceSettingsServiceClient();

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

    // Run request
    const response = await resourcesettingsClient.getSetting(request);
    console.log(response);
  }

  callGetSetting();

getSetting(request, options, callback)

getSetting(request: protos.google.cloud.resourcesettings.v1.IGetSettingRequest, options: CallOptions, callback: Callback<protos.google.cloud.resourcesettings.v1.ISetting, protos.google.cloud.resourcesettings.v1.IGetSettingRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.resourcesettings.v1.IGetSettingRequest
options CallOptions
callback Callback<protos.google.cloud.resourcesettings.v1.ISetting, protos.google.cloud.resourcesettings.v1.IGetSettingRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getSetting(request, callback)

getSetting(request: protos.google.cloud.resourcesettings.v1.IGetSettingRequest, callback: Callback<protos.google.cloud.resourcesettings.v1.ISetting, protos.google.cloud.resourcesettings.v1.IGetSettingRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.resourcesettings.v1.IGetSettingRequest
callback Callback<protos.google.cloud.resourcesettings.v1.ISetting, protos.google.cloud.resourcesettings.v1.IGetSettingRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
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
TypeDescription
Promise<{ [name: string]: Function; }>

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

listSettings(request, options)

listSettings(request?: protos.google.cloud.resourcesettings.v1.IListSettingsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.resourcesettings.v1.ISetting[],
        protos.google.cloud.resourcesettings.v1.IListSettingsRequest | null,
        protos.google.cloud.resourcesettings.v1.IListSettingsResponse
    ]>;

Lists all the settings that are available on the Cloud resource parent.

Parameters
NameDescription
request protos.google.cloud.resourcesettings.v1.IListSettingsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.resourcesettings.v1.ISetting[], protos.google.cloud.resourcesettings.v1.IListSettingsRequest | null, protos.google.cloud.resourcesettings.v1.IListSettingsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of [Setting]. 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 listSettingsAsync() 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.

listSettings(request, options, callback)

listSettings(request: protos.google.cloud.resourcesettings.v1.IListSettingsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.resourcesettings.v1.IListSettingsRequest, protos.google.cloud.resourcesettings.v1.IListSettingsResponse | null | undefined, protos.google.cloud.resourcesettings.v1.ISetting>): void;
Parameters
NameDescription
request protos.google.cloud.resourcesettings.v1.IListSettingsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.resourcesettings.v1.IListSettingsRequest, protos.google.cloud.resourcesettings.v1.IListSettingsResponse | null | undefined, protos.google.cloud.resourcesettings.v1.ISetting>
Returns
TypeDescription
void

listSettings(request, callback)

listSettings(request: protos.google.cloud.resourcesettings.v1.IListSettingsRequest, callback: PaginationCallback<protos.google.cloud.resourcesettings.v1.IListSettingsRequest, protos.google.cloud.resourcesettings.v1.IListSettingsResponse | null | undefined, protos.google.cloud.resourcesettings.v1.ISetting>): void;
Parameters
NameDescription
request protos.google.cloud.resourcesettings.v1.IListSettingsRequest
callback PaginationCallback<protos.google.cloud.resourcesettings.v1.IListSettingsRequest, protos.google.cloud.resourcesettings.v1.IListSettingsResponse | null | undefined, protos.google.cloud.resourcesettings.v1.ISetting>
Returns
TypeDescription
void

listSettingsAsync(request, options)

listSettingsAsync(request?: protos.google.cloud.resourcesettings.v1.IListSettingsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.resourcesettings.v1.ISetting>;

Equivalent to listSettings, but returns an iterable object.

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

Parameters
NameDescription
request protos.google.cloud.resourcesettings.v1.IListSettingsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.resourcesettings.v1.ISetting>

{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 [Setting]. 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

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The Cloud resource that parents the setting. Must be in one of the
   *  following forms:
   *  * `projects/{project_number}`
   *  * `projects/{project_id}`
   *  * `folders/{folder_id}`
   *  * `organizations/{organization_id}`
   */
  // const parent = 'abc123'
  /**
   *  Unused. The size of the page to be returned.
   */
  // const pageSize = 1234
  /**
   *  Unused. A page token used to retrieve the next page.
   */
  // const pageToken = 'abc123'
  /**
   *  The SettingView for this request.
   */
  // const view = {}

  // Imports the Resourcesettings library
  const {ResourceSettingsServiceClient} =
    require('@google-cloud/resource-settings').v1;

  // Instantiates a client
  const resourcesettingsClient = new ResourceSettingsServiceClient();

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

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

  callListSettings();

listSettingsStream(request, options)

listSettingsStream(request?: protos.google.cloud.resourcesettings.v1.IListSettingsRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
NameDescription
request protos.google.cloud.resourcesettings.v1.IListSettingsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing [Setting] 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 listSettingsAsync() 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.

matchFolderFromFolderSettingNameName(folderSettingNameName)

matchFolderFromFolderSettingNameName(folderSettingNameName: string): string | number;

Parse the folder from FolderSettingName resource.

Parameter
NameDescription
folderSettingNameName string

A fully-qualified path representing folder_setting_name resource.

Returns
TypeDescription
string | number

{string} A string representing the folder.

matchOrganizationFromOrganizationSettingNameName(organizationSettingNameName)

matchOrganizationFromOrganizationSettingNameName(organizationSettingNameName: string): string | number;

Parse the organization from OrganizationSettingName resource.

Parameter
NameDescription
organizationSettingNameName string

A fully-qualified path representing organization_setting_name resource.

Returns
TypeDescription
string | number

{string} A string representing the organization.

matchProjectNumberFromProjectNumberSettingNameName(projectNumberSettingNameName)

matchProjectNumberFromProjectNumberSettingNameName(projectNumberSettingNameName: string): string | number;

Parse the project_number from ProjectNumberSettingName resource.

Parameter
NameDescription
projectNumberSettingNameName string

A fully-qualified path representing project_number_setting_name resource.

Returns
TypeDescription
string | number

{string} A string representing the project_number.

matchSettingNameFromFolderSettingNameName(folderSettingNameName)

matchSettingNameFromFolderSettingNameName(folderSettingNameName: string): string | number;

Parse the setting_name from FolderSettingName resource.

Parameter
NameDescription
folderSettingNameName string

A fully-qualified path representing folder_setting_name resource.

Returns
TypeDescription
string | number

{string} A string representing the setting_name.

matchSettingNameFromOrganizationSettingNameName(organizationSettingNameName)

matchSettingNameFromOrganizationSettingNameName(organizationSettingNameName: string): string | number;

Parse the setting_name from OrganizationSettingName resource.

Parameter
NameDescription
organizationSettingNameName string

A fully-qualified path representing organization_setting_name resource.

Returns
TypeDescription
string | number

{string} A string representing the setting_name.

matchSettingNameFromProjectNumberSettingNameName(projectNumberSettingNameName)

matchSettingNameFromProjectNumberSettingNameName(projectNumberSettingNameName: string): string | number;

Parse the setting_name from ProjectNumberSettingName resource.

Parameter
NameDescription
projectNumberSettingNameName string

A fully-qualified path representing project_number_setting_name resource.

Returns
TypeDescription
string | number

{string} A string representing the setting_name.

organizationSettingNamePath(organization, settingName)

organizationSettingNamePath(organization: string, settingName: string): string;

Return a fully-qualified organizationSettingName resource name string.

Parameters
NameDescription
organization string
settingName string
Returns
TypeDescription
string

{string} Resource name string.

projectNumberSettingNamePath(projectNumber, settingName)

projectNumberSettingNamePath(projectNumber: string, settingName: string): string;

Return a fully-qualified projectNumberSettingName resource name string.

Parameters
NameDescription
projectNumber string
settingName string
Returns
TypeDescription
string

{string} Resource name string.

updateSetting(request, options)

updateSetting(request?: protos.google.cloud.resourcesettings.v1.IUpdateSettingRequest, options?: CallOptions): Promise<[
        protos.google.cloud.resourcesettings.v1.ISetting,
        protos.google.cloud.resourcesettings.v1.IUpdateSettingRequest | undefined,
        {} | undefined
    ]>;

Updates a setting.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the setting does not exist. Returns a google.rpc.Status with google.rpc.Code.FAILED_PRECONDITION if the setting is flagged as read only. Returns a google.rpc.Status with google.rpc.Code.ABORTED if the etag supplied in the request does not match the persisted etag of the setting value.

On success, the response will contain only name, local_value and etag. The metadata and effective_value cannot be updated through this API.

Note: the supplied setting will perform a full overwrite of the local_value field.

Parameters
NameDescription
request protos.google.cloud.resourcesettings.v1.IUpdateSettingRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.resourcesettings.v1.ISetting, protos.google.cloud.resourcesettings.v1.IUpdateSettingRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Setting]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The setting to update. See Setting google.cloud.resourcesettings.v1.Setting  for field requirements.
   */
  // const setting = {}

  // Imports the Resourcesettings library
  const {ResourceSettingsServiceClient} =
    require('@google-cloud/resource-settings').v1;

  // Instantiates a client
  const resourcesettingsClient = new ResourceSettingsServiceClient();

  async function callUpdateSetting() {
    // Construct request
    const request = {
      setting,
    };

    // Run request
    const response = await resourcesettingsClient.updateSetting(request);
    console.log(response);
  }

  callUpdateSetting();

updateSetting(request, options, callback)

updateSetting(request: protos.google.cloud.resourcesettings.v1.IUpdateSettingRequest, options: CallOptions, callback: Callback<protos.google.cloud.resourcesettings.v1.ISetting, protos.google.cloud.resourcesettings.v1.IUpdateSettingRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.resourcesettings.v1.IUpdateSettingRequest
options CallOptions
callback Callback<protos.google.cloud.resourcesettings.v1.ISetting, protos.google.cloud.resourcesettings.v1.IUpdateSettingRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateSetting(request, callback)

updateSetting(request: protos.google.cloud.resourcesettings.v1.IUpdateSettingRequest, callback: Callback<protos.google.cloud.resourcesettings.v1.ISetting, protos.google.cloud.resourcesettings.v1.IUpdateSettingRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.resourcesettings.v1.IUpdateSettingRequest
callback Callback<protos.google.cloud.resourcesettings.v1.ISetting, protos.google.cloud.resourcesettings.v1.IUpdateSettingRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void