Class v1.ServiceHealthClient (0.1.0)

Request service health events relevant to your Google Cloud project. v1

Package

@google-cloud/servicehealth

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of ServiceHealthClient.

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

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;
    };

locationsClient

locationsClient: LocationsClient;

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.

serviceHealthStub

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

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.

eventPath(project, location, event)

eventPath(project: string, location: string, event: string): string;

Return a fully-qualified event resource name string.

Parameters
NameDescription
project string
location string
event string
Returns
TypeDescription
string

{string} Resource name string.

getEvent(request, options)

getEvent(request?: protos.google.cloud.servicehealth.v1.IGetEventRequest, options?: CallOptions): Promise<[
        protos.google.cloud.servicehealth.v1.IEvent,
        protos.google.cloud.servicehealth.v1.IGetEventRequest | undefined,
        {} | undefined
    ]>;

Retrieves a resource containing information about an event.

Parameters
NameDescription
request IGetEventRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.servicehealth.v1.IEvent, protos.google.cloud.servicehealth.v1.IGetEventRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . 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. Unique name of the event in this scope including project
   *  and location using the form
   *  `projects/{project_id}/locations/{location}/events/{event_id}`.
   *  `project_id` - Project ID of the project that contains the event. 
* `location` - The location to get the service health events from.
* `event_id` - Event ID to retrieve. */ // const name = 'abc123' // Imports the Servicehealth library const {ServiceHealthClient} = require('@google-cloud/servicehealth').v1; // Instantiates a client const servicehealthClient = new ServiceHealthClient(); async function callGetEvent() { // Construct request const request = { name, }; // Run request const response = await servicehealthClient.getEvent(request); console.log(response); } callGetEvent();

getEvent(request, options, callback)

getEvent(request: protos.google.cloud.servicehealth.v1.IGetEventRequest, options: CallOptions, callback: Callback<protos.google.cloud.servicehealth.v1.IEvent, protos.google.cloud.servicehealth.v1.IGetEventRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetEventRequest
options CallOptions
callback Callback<protos.google.cloud.servicehealth.v1.IEvent, protos.google.cloud.servicehealth.v1.IGetEventRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getEvent(request, callback)

getEvent(request: protos.google.cloud.servicehealth.v1.IGetEventRequest, callback: Callback<protos.google.cloud.servicehealth.v1.IEvent, protos.google.cloud.servicehealth.v1.IGetEventRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetEventRequest
callback Callback<protos.google.cloud.servicehealth.v1.IEvent, protos.google.cloud.servicehealth.v1.IGetEventRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getLocation(request, options, callback)

getLocation(request: LocationProtos.google.cloud.location.IGetLocationRequest, options?: gax.CallOptions | Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>, callback?: Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>): Promise<LocationProtos.google.cloud.location.ILocation>;

Gets information about a location.

Parameters
NameDescription
request LocationProtos.google.cloud.location.IGetLocationRequest

The request object that will be sent.

options CallOptions | Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>

Call options. See CallOptions for more details.

callback Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
Promise<google.cloud.location.ILocation>

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

Example

const [response] = await client.getLocation(request);

getOrganizationEvent(request, options)

getOrganizationEvent(request?: protos.google.cloud.servicehealth.v1.IGetOrganizationEventRequest, options?: CallOptions): Promise<[
        protos.google.cloud.servicehealth.v1.IOrganizationEvent,
        (protos.google.cloud.servicehealth.v1.IGetOrganizationEventRequest | undefined),
        {} | undefined
    ]>;

Retrieves a resource containing information about an event affecting an organization .

Parameters
NameDescription
request IGetOrganizationEventRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.servicehealth.v1.IOrganizationEvent, (protos.google.cloud.servicehealth.v1.IGetOrganizationEventRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . 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. Unique name of the event in this scope including organization and
   *  event ID using the form
   *  `organizations/{organization_id}/locations/locations/global/organizationEvents/{event_id}`.
   *  `organization_id` - ID (number) of the project that contains the event. To
   *  get your `organization_id`, see
   *  Getting your organization resource
   *  ID (https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).
* `event_id` - Organization event ID to retrieve. */ // const name = 'abc123' // Imports the Servicehealth library const {ServiceHealthClient} = require('@google-cloud/servicehealth').v1; // Instantiates a client const servicehealthClient = new ServiceHealthClient(); async function callGetOrganizationEvent() { // Construct request const request = { name, }; // Run request const response = await servicehealthClient.getOrganizationEvent(request); console.log(response); } callGetOrganizationEvent();

getOrganizationEvent(request, options, callback)

getOrganizationEvent(request: protos.google.cloud.servicehealth.v1.IGetOrganizationEventRequest, options: CallOptions, callback: Callback<protos.google.cloud.servicehealth.v1.IOrganizationEvent, protos.google.cloud.servicehealth.v1.IGetOrganizationEventRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetOrganizationEventRequest
options CallOptions
callback Callback<protos.google.cloud.servicehealth.v1.IOrganizationEvent, protos.google.cloud.servicehealth.v1.IGetOrganizationEventRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getOrganizationEvent(request, callback)

getOrganizationEvent(request: protos.google.cloud.servicehealth.v1.IGetOrganizationEventRequest, callback: Callback<protos.google.cloud.servicehealth.v1.IOrganizationEvent, protos.google.cloud.servicehealth.v1.IGetOrganizationEventRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetOrganizationEventRequest
callback Callback<protos.google.cloud.servicehealth.v1.IOrganizationEvent, protos.google.cloud.servicehealth.v1.IGetOrganizationEventRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getOrganizationImpact(request, options)

getOrganizationImpact(request?: protos.google.cloud.servicehealth.v1.IGetOrganizationImpactRequest, options?: CallOptions): Promise<[
        protos.google.cloud.servicehealth.v1.IOrganizationImpact,
        (protos.google.cloud.servicehealth.v1.IGetOrganizationImpactRequest | undefined),
        {} | undefined
    ]>;

Retrieves a resource containing information about impact to an asset under an organization affected by a service health event.

Parameters
NameDescription
request IGetOrganizationImpactRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.servicehealth.v1.IOrganizationImpact, (protos.google.cloud.servicehealth.v1.IGetOrganizationImpactRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing OrganizationImpact. 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. Name of the resource using the form
   *  `organizations/{organization_id}/locations/global/organizationImpacts/{organization_impact_id}`.
   *  `organization_id` - ID (number) of the organization that contains the
   *  event. To get your `organization_id`, see
   *  Getting your organization resource
   *  ID (https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).
* `organization_impact_id` - ID of the OrganizationImpact * resource (/service-health/docs/reference/rest/v1beta/organizations.locations.organizationImpacts#OrganizationImpact). */ // const name = 'abc123' // Imports the Servicehealth library const {ServiceHealthClient} = require('@google-cloud/servicehealth').v1; // Instantiates a client const servicehealthClient = new ServiceHealthClient(); async function callGetOrganizationImpact() { // Construct request const request = { name, }; // Run request const response = await servicehealthClient.getOrganizationImpact(request); console.log(response); } callGetOrganizationImpact();

getOrganizationImpact(request, options, callback)

getOrganizationImpact(request: protos.google.cloud.servicehealth.v1.IGetOrganizationImpactRequest, options: CallOptions, callback: Callback<protos.google.cloud.servicehealth.v1.IOrganizationImpact, protos.google.cloud.servicehealth.v1.IGetOrganizationImpactRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetOrganizationImpactRequest
options CallOptions
callback Callback<protos.google.cloud.servicehealth.v1.IOrganizationImpact, protos.google.cloud.servicehealth.v1.IGetOrganizationImpactRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getOrganizationImpact(request, callback)

getOrganizationImpact(request: protos.google.cloud.servicehealth.v1.IGetOrganizationImpactRequest, callback: Callback<protos.google.cloud.servicehealth.v1.IOrganizationImpact, protos.google.cloud.servicehealth.v1.IGetOrganizationImpactRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetOrganizationImpactRequest
callback Callback<protos.google.cloud.servicehealth.v1.IOrganizationImpact, protos.google.cloud.servicehealth.v1.IGetOrganizationImpactRequest | 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

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.

listEvents(request, options)

listEvents(request?: protos.google.cloud.servicehealth.v1.IListEventsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.servicehealth.v1.IEvent[],
        protos.google.cloud.servicehealth.v1.IListEventsRequest | null,
        protos.google.cloud.servicehealth.v1.IListEventsResponse
    ]>;

Lists events under a given project and location.

Parameters
NameDescription
request IListEventsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.servicehealth.v1.IEvent[], protos.google.cloud.servicehealth.v1.IListEventsRequest | null, protos.google.cloud.servicehealth.v1.IListEventsResponse ]>

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

listEvents(request, options, callback)

listEvents(request: protos.google.cloud.servicehealth.v1.IListEventsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.servicehealth.v1.IListEventsRequest, protos.google.cloud.servicehealth.v1.IListEventsResponse | null | undefined, protos.google.cloud.servicehealth.v1.IEvent>): void;
Parameters
NameDescription
request IListEventsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.servicehealth.v1.IListEventsRequest, protos.google.cloud.servicehealth.v1.IListEventsResponse | null | undefined, protos.google.cloud.servicehealth.v1.IEvent>
Returns
TypeDescription
void

listEvents(request, callback)

listEvents(request: protos.google.cloud.servicehealth.v1.IListEventsRequest, callback: PaginationCallback<protos.google.cloud.servicehealth.v1.IListEventsRequest, protos.google.cloud.servicehealth.v1.IListEventsResponse | null | undefined, protos.google.cloud.servicehealth.v1.IEvent>): void;
Parameters
NameDescription
request IListEventsRequest
callback PaginationCallback<protos.google.cloud.servicehealth.v1.IListEventsRequest, protos.google.cloud.servicehealth.v1.IListEventsResponse | null | undefined, protos.google.cloud.servicehealth.v1.IEvent>
Returns
TypeDescription
void

listEventsAsync(request, options)

listEventsAsync(request?: protos.google.cloud.servicehealth.v1.IListEventsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.servicehealth.v1.IEvent>;

Equivalent to listEvents, but returns an iterable object.

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

Parameters
NameDescription
request IListEventsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.servicehealth.v1.IEvent>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . 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. Parent value using the form
   *  `projects/{project_id}/locations/{location}/events`.
   *  `project_id` - ID of the project for which to list service health
   *  events.
   *  `location` - The location to get the service health events from.
   *  To retrieve service health events of category = INCIDENT, use `location` =
   *  `global`.
   */
  // const parent = 'abc123'
  /**
   *  Optional. The maximum number of events that should be returned.  Acceptable
   *  values are 1 to 100, inclusive. (The default value is 10.) If more results
   *  are available, the service returns a next_page_token that you can use to
   *  get the next page of results in subsequent list requests. The service may
   *  return fewer events than the requested page_size.
   */
  // const pageSize = 1234
  /**
   *  Optional. A token identifying a page of results the server should return.
   *  Provide Page token returned by a previous `ListEvents` call to retrieve the
   *  next page of results. When paginating, all other parameters provided to
   *  `ListEvents` must match the call that provided the page token.
   */
  // const pageToken = 'abc123'
  /**
   *  Optional. A filter expression that filters resources listed in the
   *  response. The expression takes the following forms: 
* * field=value for `category` and `state`
* * field <, >, <=, or >= value for `update_time`
* Examples: `category=INCIDENT`, `update_time>=2000-01-01T11:30:00-04:00` *
* Multiple filter queries are separated by spaces. Example: * `category=INCIDENT state=ACTIVE`. * By default, each expression is an AND expression. However, you can include * AND and OR expressions explicitly. * Filter is supported for the following fields: `category`, `state`, * `update_time` */ // const filter = 'abc123' /** * Optional. Event fields to include in response. */ // const view = {} // Imports the Servicehealth library const {ServiceHealthClient} = require('@google-cloud/servicehealth').v1; // Instantiates a client const servicehealthClient = new ServiceHealthClient(); async function callListEvents() { // Construct request const request = { parent, }; // Run request const iterable = await servicehealthClient.listEventsAsync(request); for await (const response of iterable) { console.log(response); } } callListEvents();

listEventsStream(request, options)

listEventsStream(request?: protos.google.cloud.servicehealth.v1.IListEventsRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request IListEventsRequest

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

listLocationsAsync(request, options)

listLocationsAsync(request: LocationProtos.google.cloud.location.IListLocationsRequest, options?: CallOptions): AsyncIterable<LocationProtos.google.cloud.location.ILocation>;

Lists information about the supported locations for this service. Returns an iterable object.

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

Parameters
NameDescription
request LocationProtos.google.cloud.location.IListLocationsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<google.cloud.location.ILocation>

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

const iterable = client.listLocationsAsync(request);
for await (const response of iterable) {
  // process response
}

listOrganizationEvents(request, options)

listOrganizationEvents(request?: protos.google.cloud.servicehealth.v1.IListOrganizationEventsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.servicehealth.v1.IOrganizationEvent[],
        protos.google.cloud.servicehealth.v1.IListOrganizationEventsRequest | null,
        protos.google.cloud.servicehealth.v1.IListOrganizationEventsResponse
    ]>;

Lists organization events under a given organization and location.

Parameters
NameDescription
request IListOrganizationEventsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.servicehealth.v1.IOrganizationEvent[], protos.google.cloud.servicehealth.v1.IListOrganizationEventsRequest | null, protos.google.cloud.servicehealth.v1.IListOrganizationEventsResponse ]>

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

listOrganizationEvents(request, options, callback)

listOrganizationEvents(request: protos.google.cloud.servicehealth.v1.IListOrganizationEventsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.servicehealth.v1.IListOrganizationEventsRequest, protos.google.cloud.servicehealth.v1.IListOrganizationEventsResponse | null | undefined, protos.google.cloud.servicehealth.v1.IOrganizationEvent>): void;
Parameters
NameDescription
request IListOrganizationEventsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.servicehealth.v1.IListOrganizationEventsRequest, protos.google.cloud.servicehealth.v1.IListOrganizationEventsResponse | null | undefined, protos.google.cloud.servicehealth.v1.IOrganizationEvent>
Returns
TypeDescription
void

listOrganizationEvents(request, callback)

listOrganizationEvents(request: protos.google.cloud.servicehealth.v1.IListOrganizationEventsRequest, callback: PaginationCallback<protos.google.cloud.servicehealth.v1.IListOrganizationEventsRequest, protos.google.cloud.servicehealth.v1.IListOrganizationEventsResponse | null | undefined, protos.google.cloud.servicehealth.v1.IOrganizationEvent>): void;
Parameters
NameDescription
request IListOrganizationEventsRequest
callback PaginationCallback<protos.google.cloud.servicehealth.v1.IListOrganizationEventsRequest, protos.google.cloud.servicehealth.v1.IListOrganizationEventsResponse | null | undefined, protos.google.cloud.servicehealth.v1.IOrganizationEvent>
Returns
TypeDescription
void

listOrganizationEventsAsync(request, options)

listOrganizationEventsAsync(request?: protos.google.cloud.servicehealth.v1.IListOrganizationEventsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.servicehealth.v1.IOrganizationEvent>;

Equivalent to listOrganizationEvents, but returns an iterable object.

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

Parameters
NameDescription
request IListOrganizationEventsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.servicehealth.v1.IOrganizationEvent>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . 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. Parent value using the form
   *  `organizations/{organization_id}/locations/{location}/organizationEvents`.
   *  `organization_id` - ID (number) of the project that contains the event. To
   *  get your `organization_id`, see
   *  Getting your organization resource
   *  ID (https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).
* `location` - The location to get the service health events from. To * retrieve service health events of category = INCIDENT, use `location` = * `global`. */ // const parent = 'abc123' /** * Optional. The maximum number of events that should be returned. Acceptable * values are `1` to `100`, inclusive. (The default value is `10`.) If more * results are available, the service returns a `next_page_token` that you can * use to get the next page of results in subsequent list requests. The * service may return fewer events than the requested `page_size`. */ // const pageSize = 1234 /** * Optional. A token identifying a page of results the server should return. * Provide Page token returned by a previous `ListOrganizationEvents` call to * retrieve the next page of results. * When paginating, all other parameters provided to * `ListOrganizationEvents` must match the call that provided the page token. */ // const pageToken = 'abc123' /** * Optional. A filter expression that filters resources listed in the * response. The expression takes the following forms: * * field=value for `category` and `state` * * field <, >, <=, or >= value for `update_time` * Examples: `category=INCIDENT`, `update_time>=2000-01-01T11:30:00-04:00` * Multiple filter queries are space-separated. Example: * `category=INCIDENT state=ACTIVE`. * By default, each expression is an AND expression. However, you can include * AND and OR expressions explicitly. * Filter is supported for the following fields: `category`, `state`, * `update_time` */ // const filter = 'abc123' /** * Optional. OrganizationEvent fields to include in response. */ // const view = {} // Imports the Servicehealth library const {ServiceHealthClient} = require('@google-cloud/servicehealth').v1; // Instantiates a client const servicehealthClient = new ServiceHealthClient(); async function callListOrganizationEvents() { // Construct request const request = { parent, }; // Run request const iterable = await servicehealthClient.listOrganizationEventsAsync(request); for await (const response of iterable) { console.log(response); } } callListOrganizationEvents();

listOrganizationEventsStream(request, options)

listOrganizationEventsStream(request?: protos.google.cloud.servicehealth.v1.IListOrganizationEventsRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request IListOrganizationEventsRequest

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

listOrganizationImpacts(request, options)

listOrganizationImpacts(request?: protos.google.cloud.servicehealth.v1.IListOrganizationImpactsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.servicehealth.v1.IOrganizationImpact[],
        protos.google.cloud.servicehealth.v1.IListOrganizationImpactsRequest | null,
        protos.google.cloud.servicehealth.v1.IListOrganizationImpactsResponse
    ]>;

Lists assets impacted by organization events under a given organization and location.

Parameters
NameDescription
request IListOrganizationImpactsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.servicehealth.v1.IOrganizationImpact[], protos.google.cloud.servicehealth.v1.IListOrganizationImpactsRequest | null, protos.google.cloud.servicehealth.v1.IListOrganizationImpactsResponse ]>

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

listOrganizationImpacts(request, options, callback)

listOrganizationImpacts(request: protos.google.cloud.servicehealth.v1.IListOrganizationImpactsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.servicehealth.v1.IListOrganizationImpactsRequest, protos.google.cloud.servicehealth.v1.IListOrganizationImpactsResponse | null | undefined, protos.google.cloud.servicehealth.v1.IOrganizationImpact>): void;
Parameters
NameDescription
request IListOrganizationImpactsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.servicehealth.v1.IListOrganizationImpactsRequest, protos.google.cloud.servicehealth.v1.IListOrganizationImpactsResponse | null | undefined, protos.google.cloud.servicehealth.v1.IOrganizationImpact>
Returns
TypeDescription
void

listOrganizationImpacts(request, callback)

listOrganizationImpacts(request: protos.google.cloud.servicehealth.v1.IListOrganizationImpactsRequest, callback: PaginationCallback<protos.google.cloud.servicehealth.v1.IListOrganizationImpactsRequest, protos.google.cloud.servicehealth.v1.IListOrganizationImpactsResponse | null | undefined, protos.google.cloud.servicehealth.v1.IOrganizationImpact>): void;
Parameters
NameDescription
request IListOrganizationImpactsRequest
callback PaginationCallback<protos.google.cloud.servicehealth.v1.IListOrganizationImpactsRequest, protos.google.cloud.servicehealth.v1.IListOrganizationImpactsResponse | null | undefined, protos.google.cloud.servicehealth.v1.IOrganizationImpact>
Returns
TypeDescription
void

listOrganizationImpactsAsync(request, options)

listOrganizationImpactsAsync(request?: protos.google.cloud.servicehealth.v1.IListOrganizationImpactsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.servicehealth.v1.IOrganizationImpact>;

Equivalent to listOrganizationImpacts, but returns an iterable object.

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

Parameters
NameDescription
request IListOrganizationImpactsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.servicehealth.v1.IOrganizationImpact>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing OrganizationImpact. 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. Parent value using the form
   *  `organizations/{organization_id}/locations/{location}/organizationImpacts`.
   *  `organization_id` - ID (number) of the project that contains the event. To
   *  get your `organization_id`, see
   *  Getting your organization resource
   *  ID (https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).
   */
  // const parent = 'abc123'
  /**
   *  Optional. The maximum number of events that should be returned. Acceptable
   *  values are `1` to `100`, inclusive. The default value is `10`.
   *   If more results are available, the service returns a
   *  `next_page_token` that can be used to get the next page of results in
   *  subsequent list requests. The service may return fewer
   *  impacts (/service-health/docs/reference/rest/v1beta/organizations.locations.organizationImpacts#OrganizationImpact)
   *  than the requested `page_size`.
   */
  // const pageSize = 1234
  /**
   *  Optional. A token identifying a page of results the server should return.
   *  Provide `page_token` returned by a previous `ListOrganizationImpacts` call
   *  to retrieve the next page of results.
   *  When paginating, all other parameters provided to `ListOrganizationImpacts`
   *  must match the call that provided the page token.
   */
  // const pageToken = 'abc123'
  /**
   *  Optional. A filter expression that filters resources listed in the
   *  response. The expression is in the form of `field:value` for checking if a
   *  repeated field contains a value.
   *  Example:
   *  `events:organizations%2F{organization_id}%2Flocations%2Fglobal%2ForganizationEvents%2Fevent-id`
   *  To get your `{organization_id}`, see
   *  Getting your organization resource
   *  ID (https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).
   *  Multiple filter queries are separated by spaces.
   *  By default, each expression is an AND expression. However, you can include
   *  AND and OR expressions explicitly.
   *  Filter is supported for the following fields: `events`.
   */
  // const filter = 'abc123'

  // Imports the Servicehealth library
  const {ServiceHealthClient} = require('@google-cloud/servicehealth').v1;

  // Instantiates a client
  const servicehealthClient = new ServiceHealthClient();

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

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

  callListOrganizationImpacts();

listOrganizationImpactsStream(request, options)

listOrganizationImpactsStream(request?: protos.google.cloud.servicehealth.v1.IListOrganizationImpactsRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request IListOrganizationImpactsRequest

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

matchEventFromEventName(eventName)

matchEventFromEventName(eventName: string): string | number;

Parse the event from Event resource.

Parameter
NameDescription
eventName string

A fully-qualified path representing Event resource.

Returns
TypeDescription
string | number

{string} A string representing the event.

matchEventFromOrganizationEventName(organizationEventName)

matchEventFromOrganizationEventName(organizationEventName: string): string | number;

Parse the event from OrganizationEvent resource.

Parameter
NameDescription
organizationEventName string

A fully-qualified path representing OrganizationEvent resource.

Returns
TypeDescription
string | number

{string} A string representing the event.

matchLocationFromEventName(eventName)

matchLocationFromEventName(eventName: string): string | number;

Parse the location from Event resource.

Parameter
NameDescription
eventName string

A fully-qualified path representing Event resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromOrganizationEventName(organizationEventName)

matchLocationFromOrganizationEventName(organizationEventName: string): string | number;

Parse the location from OrganizationEvent resource.

Parameter
NameDescription
organizationEventName string

A fully-qualified path representing OrganizationEvent resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromOrganizationImpactName(organizationImpactName)

matchLocationFromOrganizationImpactName(organizationImpactName: string): string | number;

Parse the location from OrganizationImpact resource.

Parameter
NameDescription
organizationImpactName string

A fully-qualified path representing OrganizationImpact resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchOrganizationFromOrganizationEventName(organizationEventName)

matchOrganizationFromOrganizationEventName(organizationEventName: string): string | number;

Parse the organization from OrganizationEvent resource.

Parameter
NameDescription
organizationEventName string

A fully-qualified path representing OrganizationEvent resource.

Returns
TypeDescription
string | number

{string} A string representing the organization.

matchOrganizationFromOrganizationImpactName(organizationImpactName)

matchOrganizationFromOrganizationImpactName(organizationImpactName: string): string | number;

Parse the organization from OrganizationImpact resource.

Parameter
NameDescription
organizationImpactName string

A fully-qualified path representing OrganizationImpact resource.

Returns
TypeDescription
string | number

{string} A string representing the organization.

matchOrganizationImpactFromOrganizationImpactName(organizationImpactName)

matchOrganizationImpactFromOrganizationImpactName(organizationImpactName: string): string | number;

Parse the organization_impact from OrganizationImpact resource.

Parameter
NameDescription
organizationImpactName string

A fully-qualified path representing OrganizationImpact resource.

Returns
TypeDescription
string | number

{string} A string representing the organization_impact.

matchProjectFromEventName(eventName)

matchProjectFromEventName(eventName: string): string | number;

Parse the project from Event resource.

Parameter
NameDescription
eventName string

A fully-qualified path representing Event resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

organizationEventPath(organization, location, event)

organizationEventPath(organization: string, location: string, event: string): string;

Return a fully-qualified organizationEvent resource name string.

Parameters
NameDescription
organization string
location string
event string
Returns
TypeDescription
string

{string} Resource name string.

organizationImpactPath(organization, location, organizationImpact)

organizationImpactPath(organization: string, location: string, organizationImpact: string): string;

Return a fully-qualified organizationImpact resource name string.

Parameters
NameDescription
organization string
location string
organizationImpact string
Returns
TypeDescription
string

{string} Resource name string.