SecurityCenterClient

SecurityCenterClient

V1 APIs for Security Center service.

Constructor

new SecurityCenterClient(optionsopt, gaxInstanceopt)

Construct an instance of SecurityCenterClient.

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
Name Type Attributes Description
credentials object <optional>

Credentials object.

Properties
Name Type Attributes Description
client_email string <optional>
private_key string <optional>
email string <optional>

Account email address. Required when using a .pem or .p12 keyFilename.

keyFilename string <optional>

Full path to the a .json, .pem, or .p12 key downloaded from the Google Developers Console. If you provide a path to a JSON file, the projectId option below is not necessary. NOTE: .pem and .p12 require you to specify options.email as well.

port number <optional>

The port on which to connect to the remote host.

projectId string <optional>

The project ID from the Google Developer's Console, e.g. 'grape-spaceship-123'. We will also check the environment variable GCLOUD_PROJECT for your project ID. If your app is running in an environment which supports Application Default Credentials, your project ID will be detected automatically.

apiEndpoint string <optional>

The domain name of the API remote host.

clientConfig gax.ClientConfig <optional>

Client configuration override. Follows the structure of gapicConfig.

fallback boolean <optional>

Use HTTP/1.1 REST mode. For more information, please check the documentation.

gaxInstance gax <optional>

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

Members

apiEndpoint

The DNS address for this API service.

apiEndpoint

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

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

cancelOperation(request, optionsopt, callbackopt) → {Promise}

Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

The name of the operation resource to be cancelled.

options Object <optional>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback function <optional>

The function which will be called with the result of the API call.

Returns:
Type Description
Promise
  • The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.
Example
```
const client = longrunning.operationsClient();
await client.cancelOperation({name: ''});
```

(async) checkBulkMuteFindingsProgress(name) → {Promise}

Check the status of the long running operation returned by bulkMuteFindings().

Parameters:
Name Type Description
name String

The operation name that will be passed.

Returns:
Type Description
Promise
  • The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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, at which bulk action needs to be applied. Its format
   *  is "organizations/[organization_id]", "folders/[folder_id]",
   *  "projects/[project_id]".
   */
  // const parent = 'abc123'
  /**
   *  Expression that identifies findings that should be updated.
   *  The expression is a list of zero or more restrictions combined
   *  via logical operators `AND` and `OR`. Parentheses are supported, and `OR`
   *  has higher precedence than `AND`.
   *  Restrictions have the form `<field> <operator> <value>` and may have a
   *  `-` character in front of them to indicate negation. The fields map to
   *  those defined in the corresponding resource.
   *  The supported operators are:
   *  * `=` for all value types.
   *  * `>`, `<`, `>=`, `<=` for integer values.
   *  * `:`, meaning substring matching, for strings.
   *  The supported value types are:
   *  * string literals in quotes.
   *  * integer literals without quotes.
   *  * boolean literals `true` and `false` without quotes.
   */
  // const filter = 'abc123'
  /**
   *  This can be a mute configuration name or any identifier for mute/unmute
   *  of findings based on the filter.
   */
  // const muteAnnotation = 'abc123'

  // Imports the Securitycenter library
  const {SecurityCenterClient} = require('@google-cloud/security-center').v1;

  // Instantiates a client
  const securitycenterClient = new SecurityCenterClient();

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

    // Run request
    const [operation] = await securitycenterClient.bulkMuteFindings(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callBulkMuteFindings();

(async) checkRunAssetDiscoveryProgress(name) → {Promise}

Check the status of the long running operation returned by runAssetDiscovery().

Deprecated: RunAssetDiscovery is deprecated and may be removed in a future version.

Parameters:
Name Type Description
name String

The operation name that will be passed.

Returns:
Type Description
Promise
  • The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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 organization to run asset discovery for. Its format
   *  is "organizations/[organization_id]".
   */
  // const parent = 'abc123'

  // Imports the Securitycenter library
  const {SecurityCenterClient} = require('@google-cloud/security-center').v1;

  // Instantiates a client
  const securitycenterClient = new SecurityCenterClient();

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

    // Run request
    const [operation] = await securitycenterClient.runAssetDiscovery(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callRunAssetDiscovery();

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.

deleteOperation(request, optionsopt, callbackopt) → {Promise}

Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

The name of the operation resource to be deleted.

options Object <optional>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback function <optional>

The function which will be called with the result of the API call.

Returns:
Type Description
Promise
  • The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.
Example
```
const client = longrunning.operationsClient();
await client.deleteOperation({name: ''});
```

folderAssetPath(folder, asset) → {string}

Return a fully-qualified folderAsset resource name string.

Parameters:
Name Type Description
folder string
asset string
Returns:
Type Description
string

Resource name string.

folderAssetSecurityMarksPath(folder, asset) → {string}

Return a fully-qualified folderAssetSecurityMarks resource name string.

Parameters:
Name Type Description
folder string
asset string
Returns:
Type Description
string

Resource name string.

folderConstraintNamePath(folder, constraint_name) → {string}

Return a fully-qualified folderConstraintName resource name string.

Parameters:
Name Type Description
folder string
constraint_name string
Returns:
Type Description
string

Resource name string.

folderExportPath(folder, exportParam) → {string}

Return a fully-qualified folderExport resource name string.

Parameters:
Name Type Description
folder string
exportParam string
Returns:
Type Description
string

Resource name string.

folderMuteConfigPath(folder, mute_config) → {string}

Return a fully-qualified folderMuteConfig resource name string.

Parameters:
Name Type Description
folder string
mute_config string
Returns:
Type Description
string

Resource name string.

folderNotificationConfigPath(folder, notification_config) → {string}

Return a fully-qualified folderNotificationConfig resource name string.

Parameters:
Name Type Description
folder string
notification_config string
Returns:
Type Description
string

Resource name string.

folderSecurityHealthAnalyticsSettingsCustomModulePath(folder, custom_module) → {string}

Return a fully-qualified folderSecurityHealthAnalyticsSettingsCustomModule resource name string.

Parameters:
Name Type Description
folder string
custom_module string
Returns:
Type Description
string

Resource name string.

folderSecurityHealthAnalyticsSettingsEffectiveCustomModulePath(folder, effective_custom_module) → {string}

Return a fully-qualified folderSecurityHealthAnalyticsSettingsEffectiveCustomModule resource name string.

Parameters:
Name Type Description
folder string
effective_custom_module string
Returns:
Type Description
string

Resource name string.

folderSourceFindingExternalsystemPath(folder, source, finding, externalsystem) → {string}

Return a fully-qualified folderSourceFindingExternalsystem resource name string.

Parameters:
Name Type Description
folder string
source string
finding string
externalsystem string
Returns:
Type Description
string

Resource name string.