Class v1beta1.PhishingProtectionServiceV1Beta1Client (3.0.8)

Service to report phishing URIs. v1beta1

Package

@google-cloud/phishing-protection

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of PhishingProtectionServiceV1Beta1Client.

Parameters
NameDescription
opts ClientOptions
gaxInstance typeof gax | typeof gax.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 PhishingProtectionServiceV1Beta1Client({fallback: 'rest'}, 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;
    };

pathTemplates

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

phishingProtectionServiceV1Beta1Stub

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

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.

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.

matchProjectFromProjectName(projectName)

matchProjectFromProjectName(projectName: string): string | number;

Parse the project from Project resource.

Parameter
NameDescription
projectName string

A fully-qualified path representing Project resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

projectPath(project)

projectPath(project: string): string;

Return a fully-qualified project resource name string.

Parameter
NameDescription
project string
Returns
TypeDescription
string

{string} Resource name string.

reportPhishing(request, options)

reportPhishing(request?: protos.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest, options?: CallOptions): Promise<[
        protos.google.cloud.phishingprotection.v1beta1.IReportPhishingResponse,
        (protos.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest | undefined),
        {} | undefined
    ]>;

Reports a URI suspected of containing phishing content to be reviewed. Once the report review is complete, its result can be found in the Cloud Security Command Center findings dashboard for Phishing Protection. If the result verifies the existence of malicious phishing content, the site will be added the to [Google's Social Engineering lists](https://support.google.com/webmasters/answer/6350487/) in order to protect users that could get exposed to this threat in the future.

Parameters
NameDescription
request protos.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.phishingprotection.v1beta1.IReportPhishingResponse, (protos.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 name of the project for which the report will be created,
   *  in the format "projects/{project_number}".
   */
  // const parent = 'abc123'
  /**
   *  Required. The URI that is being reported for phishing content to be analyzed.
   */
  // const uri = 'abc123'

  // Imports the Phishingprotection library
  const {PhishingProtectionServiceV1Beta1Client} = require('@google-cloud/phishing-protection').v1beta1;

  // Instantiates a client
  const phishingprotectionClient = new PhishingProtectionServiceV1Beta1Client();

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

    // Run request
    const response = await phishingprotectionClient.reportPhishing(request);
    console.log(response);
  }

  callReportPhishing();

reportPhishing(request, options, callback)

reportPhishing(request: protos.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest, options: CallOptions, callback: Callback<protos.google.cloud.phishingprotection.v1beta1.IReportPhishingResponse, protos.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest
options CallOptions
callback Callback<protos.google.cloud.phishingprotection.v1beta1.IReportPhishingResponse, protos.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

reportPhishing(request, callback)

reportPhishing(request: protos.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest, callback: Callback<protos.google.cloud.phishingprotection.v1beta1.IReportPhishingResponse, protos.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest
callback Callback<protos.google.cloud.phishingprotection.v1beta1.IReportPhishingResponse, protos.google.cloud.phishingprotection.v1beta1.IReportPhishingRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void