Class v1.FirewallClient (3.2.0)

Firewall resources are used to define a collection of access control rules for an Application. Each rule is defined with a position which specifies the rule's order in the sequence of rules, an IP range to be matched against requests, and an action to take upon matching requests.

Every request is evaluated against the Firewall rules in priority order. Processesing stops at the first rule which matches the request's IP address. A final rule always specifies an action that applies to all remaining IP addresses. The default final rule for a newly-created application will be set to "allow" if not otherwise specified by the user. v1

Package

@google-cloud/appengine-admin

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of FirewallClient.

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

Properties

apiEndpoint

get apiEndpoint(): string;

The DNS address for this API service.

apiEndpoint

static get apiEndpoint(): string;

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

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

firewallStub

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

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.

universeDomain

get universeDomain(): string;

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

batchUpdateIngressRules(request, options)

batchUpdateIngressRules(request?: protos.google.appengine.v1.IBatchUpdateIngressRulesRequest, options?: CallOptions): Promise<[
        protos.google.appengine.v1.IBatchUpdateIngressRulesResponse,
        protos.google.appengine.v1.IBatchUpdateIngressRulesRequest | undefined,
        {} | undefined
    ]>;

Replaces the entire firewall ruleset in one bulk operation. This overrides and replaces the rules of an existing firewall with the new rules.

If the final rule does not match traffic with the '*' wildcard IP range, then an "allow all" rule is explicitly added to the end of the list.

Parameters
NameDescription
request IBatchUpdateIngressRulesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.appengine.v1.IBatchUpdateIngressRulesResponse, protos.google.appengine.v1.IBatchUpdateIngressRulesRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing BatchUpdateIngressRulesResponse. 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.
   */
  /**
   *  Name of the Firewall collection to set.
   *  Example: `apps/myapp/firewall/ingressRules`.
   */
  // const name = 'abc123'
  /**
   *  A list of FirewallRules to replace the existing set.
   */
  // const ingressRules = [1,2,3,4]

  // Imports the Appengine library
  const {FirewallClient} = require('@google-cloud/appengine-admin').v1;

  // Instantiates a client
  const appengineClient = new FirewallClient();

  async function callBatchUpdateIngressRules() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await appengineClient.batchUpdateIngressRules(request);
    console.log(response);
  }

  callBatchUpdateIngressRules();

batchUpdateIngressRules(request, options, callback)

batchUpdateIngressRules(request: protos.google.appengine.v1.IBatchUpdateIngressRulesRequest, options: CallOptions, callback: Callback<protos.google.appengine.v1.IBatchUpdateIngressRulesResponse, protos.google.appengine.v1.IBatchUpdateIngressRulesRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IBatchUpdateIngressRulesRequest
options CallOptions
callback Callback<protos.google.appengine.v1.IBatchUpdateIngressRulesResponse, protos.google.appengine.v1.IBatchUpdateIngressRulesRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

batchUpdateIngressRules(request, callback)

batchUpdateIngressRules(request: protos.google.appengine.v1.IBatchUpdateIngressRulesRequest, callback: Callback<protos.google.appengine.v1.IBatchUpdateIngressRulesResponse, protos.google.appengine.v1.IBatchUpdateIngressRulesRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IBatchUpdateIngressRulesRequest
callback Callback<protos.google.appengine.v1.IBatchUpdateIngressRulesResponse, protos.google.appengine.v1.IBatchUpdateIngressRulesRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

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.

createIngressRule(request, options)

createIngressRule(request?: protos.google.appengine.v1.ICreateIngressRuleRequest, options?: CallOptions): Promise<[
        protos.google.appengine.v1.IFirewallRule,
        protos.google.appengine.v1.ICreateIngressRuleRequest | undefined,
        {} | undefined
    ]>;

Creates a firewall rule for the application.

Parameters
NameDescription
request ICreateIngressRuleRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.appengine.v1.IFirewallRule, protos.google.appengine.v1.ICreateIngressRuleRequest | 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.
   */
  /**
   *  Name of the parent Firewall collection in which to create a new rule.
   *  Example: `apps/myapp/firewall/ingressRules`.
   */
  // const parent = 'abc123'
  /**
   *  A FirewallRule containing the new resource.
   *  The user may optionally provide a position at which the new rule will be
   *  placed. The positions define a sequential list starting at 1. If a rule
   *  already exists at the given position, rules greater than the provided
   *  position will be moved forward by one.
   *  If no position is provided, the server will place the rule as the second to
   *  last rule in the sequence before the required default allow-all or deny-all
   *  rule.
   */
  // const rule = {}

  // Imports the Appengine library
  const {FirewallClient} = require('@google-cloud/appengine-admin').v1;

  // Instantiates a client
  const appengineClient = new FirewallClient();

  async function callCreateIngressRule() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await appengineClient.createIngressRule(request);
    console.log(response);
  }

  callCreateIngressRule();

createIngressRule(request, options, callback)

createIngressRule(request: protos.google.appengine.v1.ICreateIngressRuleRequest, options: CallOptions, callback: Callback<protos.google.appengine.v1.IFirewallRule, protos.google.appengine.v1.ICreateIngressRuleRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ICreateIngressRuleRequest
options CallOptions
callback Callback<protos.google.appengine.v1.IFirewallRule, protos.google.appengine.v1.ICreateIngressRuleRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createIngressRule(request, callback)

createIngressRule(request: protos.google.appengine.v1.ICreateIngressRuleRequest, callback: Callback<protos.google.appengine.v1.IFirewallRule, protos.google.appengine.v1.ICreateIngressRuleRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ICreateIngressRuleRequest
callback Callback<protos.google.appengine.v1.IFirewallRule, protos.google.appengine.v1.ICreateIngressRuleRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteIngressRule(request, options)

deleteIngressRule(request?: protos.google.appengine.v1.IDeleteIngressRuleRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        protos.google.appengine.v1.IDeleteIngressRuleRequest | undefined,
        {} | undefined
    ]>;

Deletes the specified firewall rule.

Parameters
NameDescription
request IDeleteIngressRuleRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.protobuf.IEmpty, protos.google.appengine.v1.IDeleteIngressRuleRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. 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.
   */
  /**
   *  Name of the Firewall resource to delete.
   *  Example: `apps/myapp/firewall/ingressRules/100`.
   */
  // const name = 'abc123'

  // Imports the Appengine library
  const {FirewallClient} = require('@google-cloud/appengine-admin').v1;

  // Instantiates a client
  const appengineClient = new FirewallClient();

  async function callDeleteIngressRule() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await appengineClient.deleteIngressRule(request);
    console.log(response);
  }

  callDeleteIngressRule();

deleteIngressRule(request, options, callback)

deleteIngressRule(request: protos.google.appengine.v1.IDeleteIngressRuleRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.appengine.v1.IDeleteIngressRuleRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IDeleteIngressRuleRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.appengine.v1.IDeleteIngressRuleRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteIngressRule(request, callback)

deleteIngressRule(request: protos.google.appengine.v1.IDeleteIngressRuleRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.appengine.v1.IDeleteIngressRuleRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IDeleteIngressRuleRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.appengine.v1.IDeleteIngressRuleRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getIngressRule(request, options)

getIngressRule(request?: protos.google.appengine.v1.IGetIngressRuleRequest, options?: CallOptions): Promise<[
        protos.google.appengine.v1.IFirewallRule,
        protos.google.appengine.v1.IGetIngressRuleRequest | undefined,
        {} | undefined
    ]>;

Gets the specified firewall rule.

Parameters
NameDescription
request IGetIngressRuleRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.appengine.v1.IFirewallRule, protos.google.appengine.v1.IGetIngressRuleRequest | 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.
   */
  /**
   *  Name of the Firewall resource to retrieve.
   *  Example: `apps/myapp/firewall/ingressRules/100`.
   */
  // const name = 'abc123'

  // Imports the Appengine library
  const {FirewallClient} = require('@google-cloud/appengine-admin').v1;

  // Instantiates a client
  const appengineClient = new FirewallClient();

  async function callGetIngressRule() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await appengineClient.getIngressRule(request);
    console.log(response);
  }

  callGetIngressRule();

getIngressRule(request, options, callback)

getIngressRule(request: protos.google.appengine.v1.IGetIngressRuleRequest, options: CallOptions, callback: Callback<protos.google.appengine.v1.IFirewallRule, protos.google.appengine.v1.IGetIngressRuleRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetIngressRuleRequest
options CallOptions
callback Callback<protos.google.appengine.v1.IFirewallRule, protos.google.appengine.v1.IGetIngressRuleRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getIngressRule(request, callback)

getIngressRule(request: protos.google.appengine.v1.IGetIngressRuleRequest, callback: Callback<protos.google.appengine.v1.IFirewallRule, protos.google.appengine.v1.IGetIngressRuleRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetIngressRuleRequest
callback Callback<protos.google.appengine.v1.IFirewallRule, protos.google.appengine.v1.IGetIngressRuleRequest | 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.

instancePath(app, service, version, instance)

instancePath(app: string, service: string, version: string, instance: string): string;

Return a fully-qualified instance resource name string.

Parameters
NameDescription
app string
service string
version string
instance string
Returns
TypeDescription
string

{string} Resource name string.

listIngressRules(request, options)

listIngressRules(request?: protos.google.appengine.v1.IListIngressRulesRequest, options?: CallOptions): Promise<[
        protos.google.appengine.v1.IFirewallRule[],
        protos.google.appengine.v1.IListIngressRulesRequest | null,
        protos.google.appengine.v1.IListIngressRulesResponse
    ]>;

Lists the firewall rules of an application.

Parameters
NameDescription
request IListIngressRulesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.appengine.v1.IFirewallRule[], protos.google.appengine.v1.IListIngressRulesRequest | null, protos.google.appengine.v1.IListIngressRulesResponse ]>

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

listIngressRules(request, options, callback)

listIngressRules(request: protos.google.appengine.v1.IListIngressRulesRequest, options: CallOptions, callback: PaginationCallback<protos.google.appengine.v1.IListIngressRulesRequest, protos.google.appengine.v1.IListIngressRulesResponse | null | undefined, protos.google.appengine.v1.IFirewallRule>): void;
Parameters
NameDescription
request IListIngressRulesRequest
options CallOptions
callback PaginationCallback<protos.google.appengine.v1.IListIngressRulesRequest, protos.google.appengine.v1.IListIngressRulesResponse | null | undefined, protos.google.appengine.v1.IFirewallRule>
Returns
TypeDescription
void

listIngressRules(request, callback)

listIngressRules(request: protos.google.appengine.v1.IListIngressRulesRequest, callback: PaginationCallback<protos.google.appengine.v1.IListIngressRulesRequest, protos.google.appengine.v1.IListIngressRulesResponse | null | undefined, protos.google.appengine.v1.IFirewallRule>): void;
Parameters
NameDescription
request IListIngressRulesRequest
callback PaginationCallback<protos.google.appengine.v1.IListIngressRulesRequest, protos.google.appengine.v1.IListIngressRulesResponse | null | undefined, protos.google.appengine.v1.IFirewallRule>
Returns
TypeDescription
void

listIngressRulesAsync(request, options)

listIngressRulesAsync(request?: protos.google.appengine.v1.IListIngressRulesRequest, options?: CallOptions): AsyncIterable<protos.google.appengine.v1.IFirewallRule>;

Equivalent to listIngressRules, but returns an iterable object.

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

Parameters
NameDescription
request IListIngressRulesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.appengine.v1.IFirewallRule>

{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.
   */
  /**
   *  Name of the Firewall collection to retrieve.
   *  Example: `apps/myapp/firewall/ingressRules`.
   */
  // const parent = 'abc123'
  /**
   *  Maximum results to return per page.
   */
  // const pageSize = 1234
  /**
   *  Continuation token for fetching the next page of results.
   */
  // const pageToken = 'abc123'
  /**
   *  A valid IP Address. If set, only rules matching this address will be
   *  returned. The first returned rule will be the rule that fires on requests
   *  from this IP.
   */
  // const matchingAddress = 'abc123'

  // Imports the Appengine library
  const {FirewallClient} = require('@google-cloud/appengine-admin').v1;

  // Instantiates a client
  const appengineClient = new FirewallClient();

  async function callListIngressRules() {
    // Construct request
    const request = {
    };

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

  callListIngressRules();

listIngressRulesStream(request, options)

listIngressRulesStream(request?: protos.google.appengine.v1.IListIngressRulesRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request IListIngressRulesRequest

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

matchAppFromInstanceName(instanceName)

matchAppFromInstanceName(instanceName: string): string | number;

Parse the app from Instance resource.

Parameter
NameDescription
instanceName string

A fully-qualified path representing Instance resource.

Returns
TypeDescription
string | number

{string} A string representing the app.

matchInstanceFromInstanceName(instanceName)

matchInstanceFromInstanceName(instanceName: string): string | number;

Parse the instance from Instance resource.

Parameter
NameDescription
instanceName string

A fully-qualified path representing Instance resource.

Returns
TypeDescription
string | number

{string} A string representing the instance.

matchServiceFromInstanceName(instanceName)

matchServiceFromInstanceName(instanceName: string): string | number;

Parse the service from Instance resource.

Parameter
NameDescription
instanceName string

A fully-qualified path representing Instance resource.

Returns
TypeDescription
string | number

{string} A string representing the service.

matchVersionFromInstanceName(instanceName)

matchVersionFromInstanceName(instanceName: string): string | number;

Parse the version from Instance resource.

Parameter
NameDescription
instanceName string

A fully-qualified path representing Instance resource.

Returns
TypeDescription
string | number

{string} A string representing the version.

updateIngressRule(request, options)

updateIngressRule(request?: protos.google.appengine.v1.IUpdateIngressRuleRequest, options?: CallOptions): Promise<[
        protos.google.appengine.v1.IFirewallRule,
        protos.google.appengine.v1.IUpdateIngressRuleRequest | undefined,
        {} | undefined
    ]>;

Updates the specified firewall rule.

Parameters
NameDescription
request IUpdateIngressRuleRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.appengine.v1.IFirewallRule, protos.google.appengine.v1.IUpdateIngressRuleRequest | 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.
   */
  /**
   *  Name of the Firewall resource to update.
   *  Example: `apps/myapp/firewall/ingressRules/100`.
   */
  // const name = 'abc123'
  /**
   *  A FirewallRule containing the updated resource
   */
  // const rule = {}
  /**
   *  Standard field mask for the set of fields to be updated.
   */
  // const updateMask = {}

  // Imports the Appengine library
  const {FirewallClient} = require('@google-cloud/appengine-admin').v1;

  // Instantiates a client
  const appengineClient = new FirewallClient();

  async function callUpdateIngressRule() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await appengineClient.updateIngressRule(request);
    console.log(response);
  }

  callUpdateIngressRule();

updateIngressRule(request, options, callback)

updateIngressRule(request: protos.google.appengine.v1.IUpdateIngressRuleRequest, options: CallOptions, callback: Callback<protos.google.appengine.v1.IFirewallRule, protos.google.appengine.v1.IUpdateIngressRuleRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUpdateIngressRuleRequest
options CallOptions
callback Callback<protos.google.appengine.v1.IFirewallRule, protos.google.appengine.v1.IUpdateIngressRuleRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateIngressRule(request, callback)

updateIngressRule(request: protos.google.appengine.v1.IUpdateIngressRuleRequest, callback: Callback<protos.google.appengine.v1.IFirewallRule, protos.google.appengine.v1.IUpdateIngressRuleRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUpdateIngressRuleRequest
callback Callback<protos.google.appengine.v1.IFirewallRule, protos.google.appengine.v1.IUpdateIngressRuleRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void