Class v1.AdvisoryNotificationsServiceClient (1.1.0)

Service to manage Security and Privacy Notifications. v1

Package

@google-cloud/advisorynotifications

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of AdvisoryNotificationsServiceClient.

Parameters
NameDescription
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 AdvisoryNotificationsServiceClient({fallback: true}, gax); ```

Properties

advisoryNotificationsServiceStub

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

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.

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.

getNotification(request, options)

getNotification(request?: protos.google.cloud.advisorynotifications.v1.IGetNotificationRequest, options?: CallOptions): Promise<[
        protos.google.cloud.advisorynotifications.v1.INotification,
        (protos.google.cloud.advisorynotifications.v1.IGetNotificationRequest | undefined),
        {} | undefined
    ]>;

Gets a notification.

Parameters
NameDescription
request IGetNotificationRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.advisorynotifications.v1.INotification, (protos.google.cloud.advisorynotifications.v1.IGetNotificationRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Notification. 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. A name of the notification to retrieve.
   *  Format:
   *  organizations/{organization}/locations/{location}/notifications/{notification}
   *  or projects/{projects}/locations/{location}/notifications/{notification}.
   */
  // const name = 'abc123'
  /**
   *  ISO code for requested localization language. If unset, will be
   *  interpereted as "en". If the requested language is valid, but not supported
   *  for this notification, English will be returned with an "Not applicable"
   *  LocalizationState. If the ISO code is invalid (i.e. not a real language),
   *  this RPC will throw an error.
   */
  // const languageCode = 'abc123'

  // Imports the Advisorynotifications library
  const {AdvisoryNotificationsServiceClient} = require('@google-cloud/advisorynotifications').v1;

  // Instantiates a client
  const advisorynotificationsClient = new AdvisoryNotificationsServiceClient();

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

    // Run request
    const response = await advisorynotificationsClient.getNotification(request);
    console.log(response);
  }

  callGetNotification();

getNotification(request, options, callback)

getNotification(request: protos.google.cloud.advisorynotifications.v1.IGetNotificationRequest, options: CallOptions, callback: Callback<protos.google.cloud.advisorynotifications.v1.INotification, protos.google.cloud.advisorynotifications.v1.IGetNotificationRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetNotificationRequest
options CallOptions
callback Callback<protos.google.cloud.advisorynotifications.v1.INotification, protos.google.cloud.advisorynotifications.v1.IGetNotificationRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getNotification(request, callback)

getNotification(request: protos.google.cloud.advisorynotifications.v1.IGetNotificationRequest, callback: Callback<protos.google.cloud.advisorynotifications.v1.INotification, protos.google.cloud.advisorynotifications.v1.IGetNotificationRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetNotificationRequest
callback Callback<protos.google.cloud.advisorynotifications.v1.INotification, protos.google.cloud.advisorynotifications.v1.IGetNotificationRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

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

getSettings(request, options)

getSettings(request?: protos.google.cloud.advisorynotifications.v1.IGetSettingsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.advisorynotifications.v1.ISettings,
        (protos.google.cloud.advisorynotifications.v1.IGetSettingsRequest | undefined),
        {} | undefined
    ]>;

Get notification settings.

Parameters
NameDescription
request IGetSettingsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.advisorynotifications.v1.ISettings, (protos.google.cloud.advisorynotifications.v1.IGetSettingsRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Settings. 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 resource name of the settings to retrieve.
   *  Format:
   *  organizations/{organization}/locations/{location}/settings.
   */
  // const name = 'abc123'

  // Imports the Advisorynotifications library
  const {AdvisoryNotificationsServiceClient} = require('@google-cloud/advisorynotifications').v1;

  // Instantiates a client
  const advisorynotificationsClient = new AdvisoryNotificationsServiceClient();

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

    // Run request
    const response = await advisorynotificationsClient.getSettings(request);
    console.log(response);
  }

  callGetSettings();

getSettings(request, options, callback)

getSettings(request: protos.google.cloud.advisorynotifications.v1.IGetSettingsRequest, options: CallOptions, callback: Callback<protos.google.cloud.advisorynotifications.v1.ISettings, protos.google.cloud.advisorynotifications.v1.IGetSettingsRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetSettingsRequest
options CallOptions
callback Callback<protos.google.cloud.advisorynotifications.v1.ISettings, protos.google.cloud.advisorynotifications.v1.IGetSettingsRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getSettings(request, callback)

getSettings(request: protos.google.cloud.advisorynotifications.v1.IGetSettingsRequest, callback: Callback<protos.google.cloud.advisorynotifications.v1.ISettings, protos.google.cloud.advisorynotifications.v1.IGetSettingsRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetSettingsRequest
callback Callback<protos.google.cloud.advisorynotifications.v1.ISettings, protos.google.cloud.advisorynotifications.v1.IGetSettingsRequest | 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.

listNotifications(request, options)

listNotifications(request?: protos.google.cloud.advisorynotifications.v1.IListNotificationsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.advisorynotifications.v1.INotification[],
        protos.google.cloud.advisorynotifications.v1.IListNotificationsRequest | null,
        protos.google.cloud.advisorynotifications.v1.IListNotificationsResponse
    ]>;

Lists notifications under a given parent.

Parameters
NameDescription
request IListNotificationsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.advisorynotifications.v1.INotification[], protos.google.cloud.advisorynotifications.v1.IListNotificationsRequest | null, protos.google.cloud.advisorynotifications.v1.IListNotificationsResponse ]>

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

listNotifications(request, options, callback)

listNotifications(request: protos.google.cloud.advisorynotifications.v1.IListNotificationsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.advisorynotifications.v1.IListNotificationsRequest, protos.google.cloud.advisorynotifications.v1.IListNotificationsResponse | null | undefined, protos.google.cloud.advisorynotifications.v1.INotification>): void;
Parameters
NameDescription
request IListNotificationsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.advisorynotifications.v1.IListNotificationsRequest, protos.google.cloud.advisorynotifications.v1.IListNotificationsResponse | null | undefined, protos.google.cloud.advisorynotifications.v1.INotification>
Returns
TypeDescription
void

listNotifications(request, callback)

listNotifications(request: protos.google.cloud.advisorynotifications.v1.IListNotificationsRequest, callback: PaginationCallback<protos.google.cloud.advisorynotifications.v1.IListNotificationsRequest, protos.google.cloud.advisorynotifications.v1.IListNotificationsResponse | null | undefined, protos.google.cloud.advisorynotifications.v1.INotification>): void;
Parameters
NameDescription
request IListNotificationsRequest
callback PaginationCallback<protos.google.cloud.advisorynotifications.v1.IListNotificationsRequest, protos.google.cloud.advisorynotifications.v1.IListNotificationsResponse | null | undefined, protos.google.cloud.advisorynotifications.v1.INotification>
Returns
TypeDescription
void

listNotificationsAsync(request, options)

listNotificationsAsync(request?: protos.google.cloud.advisorynotifications.v1.IListNotificationsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.advisorynotifications.v1.INotification>;

Equivalent to listNotifications, but returns an iterable object.

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

Parameters
NameDescription
request IListNotificationsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.advisorynotifications.v1.INotification>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Notification. 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. The parent, which owns this collection of notifications.
   *  Must be of the form "organizations/{organization}/locations/{location}"
   *  or "projects/{project}/locations/{location}"
   */
  // const parent = 'abc123'
  /**
   *  The maximum number of notifications to return. The service may return
   *  fewer than this value. If unspecified or equal to 0, at most 50
   *  notifications will be returned. The maximum value is 50; values above 50
   *  will be coerced to 50.
   */
  // const pageSize = 1234
  /**
   *  A page token returned from a previous request.
   *  When paginating, all other parameters provided in the request
   *  must match the call that returned the page token.
   */
  // const pageToken = 'abc123'
  /**
   *  Specifies which parts of the notification resource should be returned
   *  in the response.
   */
  // const view = {}
  /**
   *  ISO code for requested localization language.  If unset, will be
   *  interpereted as "en". If the requested language is valid, but not supported
   *  for this notification, English will be returned with an "Not applicable"
   *  LocalizationState. If the ISO code is invalid (i.e. not a real language),
   *  this RPC will throw an error.
   */
  // const languageCode = 'abc123'

  // Imports the Advisorynotifications library
  const {AdvisoryNotificationsServiceClient} = require('@google-cloud/advisorynotifications').v1;

  // Instantiates a client
  const advisorynotificationsClient = new AdvisoryNotificationsServiceClient();

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

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

  callListNotifications();

listNotificationsStream(request, options)

listNotificationsStream(request?: protos.google.cloud.advisorynotifications.v1.IListNotificationsRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request IListNotificationsRequest

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 Notification 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 listNotificationsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

matchLocationFromOrganizationLocationName(organizationLocationName)

matchLocationFromOrganizationLocationName(organizationLocationName: string): string | number;

Parse the location from OrganizationLocation resource.

Parameter
NameDescription
organizationLocationName string

A fully-qualified path representing organization_location resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromOrganizationLocationNotificationName(organizationLocationNotificationName)

matchLocationFromOrganizationLocationNotificationName(organizationLocationNotificationName: string): string | number;

Parse the location from OrganizationLocationNotification resource.

Parameter
NameDescription
organizationLocationNotificationName string

A fully-qualified path representing organization_location_notification resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromProjectLocationNotificationName(projectLocationNotificationName)

matchLocationFromProjectLocationNotificationName(projectLocationNotificationName: string): string | number;

Parse the location from ProjectLocationNotification resource.

Parameter
NameDescription
projectLocationNotificationName string

A fully-qualified path representing project_location_notification resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromSettingsName(settingsName)

matchLocationFromSettingsName(settingsName: string): string | number;

Parse the location from Settings resource.

Parameter
NameDescription
settingsName string

A fully-qualified path representing Settings resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchNotificationFromOrganizationLocationNotificationName(organizationLocationNotificationName)

matchNotificationFromOrganizationLocationNotificationName(organizationLocationNotificationName: string): string | number;

Parse the notification from OrganizationLocationNotification resource.

Parameter
NameDescription
organizationLocationNotificationName string

A fully-qualified path representing organization_location_notification resource.

Returns
TypeDescription
string | number

{string} A string representing the notification.

matchNotificationFromProjectLocationNotificationName(projectLocationNotificationName)

matchNotificationFromProjectLocationNotificationName(projectLocationNotificationName: string): string | number;

Parse the notification from ProjectLocationNotification resource.

Parameter
NameDescription
projectLocationNotificationName string

A fully-qualified path representing project_location_notification resource.

Returns
TypeDescription
string | number

{string} A string representing the notification.

matchOrganizationFromOrganizationLocationName(organizationLocationName)

matchOrganizationFromOrganizationLocationName(organizationLocationName: string): string | number;

Parse the organization from OrganizationLocation resource.

Parameter
NameDescription
organizationLocationName string

A fully-qualified path representing organization_location resource.

Returns
TypeDescription
string | number

{string} A string representing the organization.

matchOrganizationFromOrganizationLocationNotificationName(organizationLocationNotificationName)

matchOrganizationFromOrganizationLocationNotificationName(organizationLocationNotificationName: string): string | number;

Parse the organization from OrganizationLocationNotification resource.

Parameter
NameDescription
organizationLocationNotificationName string

A fully-qualified path representing organization_location_notification resource.

Returns
TypeDescription
string | number

{string} A string representing the organization.

matchOrganizationFromSettingsName(settingsName)

matchOrganizationFromSettingsName(settingsName: string): string | number;

Parse the organization from Settings resource.

Parameter
NameDescription
settingsName string

A fully-qualified path representing Settings resource.

Returns
TypeDescription
string | number

{string} A string representing the organization.

matchProjectFromProjectLocationNotificationName(projectLocationNotificationName)

matchProjectFromProjectLocationNotificationName(projectLocationNotificationName: string): string | number;

Parse the project from ProjectLocationNotification resource.

Parameter
NameDescription
projectLocationNotificationName string

A fully-qualified path representing project_location_notification resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

organizationLocationNotificationPath(organization, location, notification)

organizationLocationNotificationPath(organization: string, location: string, notification: string): string;

Return a fully-qualified organizationLocationNotification resource name string.

Parameters
NameDescription
organization string
location string
notification string
Returns
TypeDescription
string

{string} Resource name string.

organizationLocationPath(organization, location)

organizationLocationPath(organization: string, location: string): string;

Return a fully-qualified organizationLocation resource name string.

Parameters
NameDescription
organization string
location string
Returns
TypeDescription
string

{string} Resource name string.

projectLocationNotificationPath(project, location, notification)

projectLocationNotificationPath(project: string, location: string, notification: string): string;

Return a fully-qualified projectLocationNotification resource name string.

Parameters
NameDescription
project string
location string
notification string
Returns
TypeDescription
string

{string} Resource name string.

settingsPath(organization, location)

settingsPath(organization: string, location: string): string;

Return a fully-qualified settings resource name string.

Parameters
NameDescription
organization string
location string
Returns
TypeDescription
string

{string} Resource name string.

updateSettings(request, options)

updateSettings(request?: protos.google.cloud.advisorynotifications.v1.IUpdateSettingsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.advisorynotifications.v1.ISettings,
        (protos.google.cloud.advisorynotifications.v1.IUpdateSettingsRequest | undefined),
        {} | undefined
    ]>;

Update notification settings.

Parameters
NameDescription
request IUpdateSettingsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.advisorynotifications.v1.ISettings, (protos.google.cloud.advisorynotifications.v1.IUpdateSettingsRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Settings. 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. New settings.
   */
  // const settings = {}

  // Imports the Advisorynotifications library
  const {AdvisoryNotificationsServiceClient} = require('@google-cloud/advisorynotifications').v1;

  // Instantiates a client
  const advisorynotificationsClient = new AdvisoryNotificationsServiceClient();

  async function callUpdateSettings() {
    // Construct request
    const request = {
      settings,
    };

    // Run request
    const response = await advisorynotificationsClient.updateSettings(request);
    console.log(response);
  }

  callUpdateSettings();

updateSettings(request, options, callback)

updateSettings(request: protos.google.cloud.advisorynotifications.v1.IUpdateSettingsRequest, options: CallOptions, callback: Callback<protos.google.cloud.advisorynotifications.v1.ISettings, protos.google.cloud.advisorynotifications.v1.IUpdateSettingsRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUpdateSettingsRequest
options CallOptions
callback Callback<protos.google.cloud.advisorynotifications.v1.ISettings, protos.google.cloud.advisorynotifications.v1.IUpdateSettingsRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateSettings(request, callback)

updateSettings(request: protos.google.cloud.advisorynotifications.v1.IUpdateSettingsRequest, callback: Callback<protos.google.cloud.advisorynotifications.v1.ISettings, protos.google.cloud.advisorynotifications.v1.IUpdateSettingsRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUpdateSettingsRequest
callback Callback<protos.google.cloud.advisorynotifications.v1.ISettings, protos.google.cloud.advisorynotifications.v1.IUpdateSettingsRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void