Constructor
new ServiceHealthClient(optionsopt, gaxInstanceopt)
Construct an instance of ServiceHealthClient.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
The configuration object. The options accepted by the constructor are described in detail in this document. The common options are: Properties
|
||||||||||||||||||||||||||||||||||||||||||||||||
gaxInstance |
gax |
<optional> |
loaded instance of |
Members
apiEndpoint
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
port
The port for this API service.
scopes
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
The DNS address for this API service.
Methods
close() → {Promise}
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 |
A promise that resolves when the client is closed. |
eventPath(project, location, event) → {string}
Return a fully-qualified event resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
location |
string | |
event |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
getLocation(request, optionsopt) → {Promise}
Gets information about a location.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Promise |
|
getProjectId() → {Promise}
Return the project ID used by this class.
Returns:
Type | Description |
---|---|
Promise |
A promise that resolves to string containing the project ID. |
initialize() → {Promise}
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 |
A promise that resolves to an authenticated service stub. |
listEventsAsync(request, optionsopt) → {Object}
Equivalent to listEvents
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Object |
An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Event. 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: <br>
* * field=value for `category` and `state`<br>
* * field <, >, <=, or >= value for `update_time` <br>
* Examples: `category=INCIDENT`, `update_time>=2000-01-01T11:30:00-04:00`
* <br>
* 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, optionsopt) → {Stream}
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Stream |
An object stream which emits an object representing Event 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 |
listLocationsAsync(request, optionsopt) → {Object}
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:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Object |
An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Location. 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
}
```
listOrganizationEventsAsync(request, optionsopt) → {Object}
Equivalent to listOrganizationEvents
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Object |
An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing OrganizationEvent. 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).<br>
* `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, optionsopt) → {Stream}
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Stream |
An object stream which emits an object representing OrganizationEvent 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(request, optionsopt) → {Object}
Equivalent to listOrganizationImpacts
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
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, optionsopt) → {Stream}
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
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 |
matchEventFromEventName(eventName) → {string}
Parse the event from Event resource.
Parameters:
Name | Type | Description |
---|---|---|
eventName |
string |
A fully-qualified path representing Event resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the event. |
matchEventFromOrganizationEventName(organizationEventName) → {string}
Parse the event from OrganizationEvent resource.
Parameters:
Name | Type | Description |
---|---|---|
organizationEventName |
string |
A fully-qualified path representing OrganizationEvent resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the event. |
matchLocationFromEventName(eventName) → {string}
Parse the location from Event resource.
Parameters:
Name | Type | Description |
---|---|---|
eventName |
string |
A fully-qualified path representing Event resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the location. |
matchLocationFromOrganizationEventName(organizationEventName) → {string}
Parse the location from OrganizationEvent resource.
Parameters:
Name | Type | Description |
---|---|---|
organizationEventName |
string |
A fully-qualified path representing OrganizationEvent resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the location. |
matchLocationFromOrganizationImpactName(organizationImpactName) → {string}
Parse the location from OrganizationImpact resource.
Parameters:
Name | Type | Description |
---|---|---|
organizationImpactName |
string |
A fully-qualified path representing OrganizationImpact resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the location. |
matchOrganizationFromOrganizationEventName(organizationEventName) → {string}
Parse the organization from OrganizationEvent resource.
Parameters:
Name | Type | Description |
---|---|---|
organizationEventName |
string |
A fully-qualified path representing OrganizationEvent resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the organization. |
matchOrganizationFromOrganizationImpactName(organizationImpactName) → {string}
Parse the organization from OrganizationImpact resource.
Parameters:
Name | Type | Description |
---|---|---|
organizationImpactName |
string |
A fully-qualified path representing OrganizationImpact resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the organization. |
matchOrganizationImpactFromOrganizationImpactName(organizationImpactName) → {string}
Parse the organization_impact from OrganizationImpact resource.
Parameters:
Name | Type | Description |
---|---|---|
organizationImpactName |
string |
A fully-qualified path representing OrganizationImpact resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the organization_impact. |
matchProjectFromEventName(eventName) → {string}
Parse the project from Event resource.
Parameters:
Name | Type | Description |
---|---|---|
eventName |
string |
A fully-qualified path representing Event resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
organizationEventPath(organization, location, event) → {string}
Return a fully-qualified organizationEvent resource name string.
Parameters:
Name | Type | Description |
---|---|---|
organization |
string | |
location |
string | |
event |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
organizationImpactPath(organization, location, organization_impact) → {string}
Return a fully-qualified organizationImpact resource name string.
Parameters:
Name | Type | Description |
---|---|---|
organization |
string | |
location |
string | |
organization_impact |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |