App Engine v1 API - Class FirewallClient (2.3.0)

public abstract class FirewallClient

Reference documentation and code samples for the App Engine v1 API class FirewallClient.

Firewall client wrapper, for convenient use.

Inheritance

object > FirewallClient

Derived Types

Namespace

Google.Cloud.AppEngine.V1

Assembly

Google.Cloud.AppEngine.V1.dll

Remarks

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.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the Firewall service, which is a host of "appengine.googleapis.com" and a port of 443.

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default Firewall scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

GrpcClient

public virtual Firewall.FirewallClient GrpcClient { get; }

The underlying gRPC Firewall client

Property Value
Type Description
FirewallFirewallClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

BatchUpdateIngressRules(BatchUpdateIngressRulesRequest, CallSettings)

public virtual BatchUpdateIngressRulesResponse BatchUpdateIngressRules(BatchUpdateIngressRulesRequest request, CallSettings callSettings = null)

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
Name Description
request BatchUpdateIngressRulesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
BatchUpdateIngressRulesResponse

The RPC response.

Example
// Create client
FirewallClient firewallClient = FirewallClient.Create();
// Initialize request argument(s)
BatchUpdateIngressRulesRequest request = new BatchUpdateIngressRulesRequest
{
    Name = "",
    IngressRules = { new FirewallRule(), },
};
// Make the request
BatchUpdateIngressRulesResponse response = firewallClient.BatchUpdateIngressRules(request);

BatchUpdateIngressRulesAsync(BatchUpdateIngressRulesRequest, CallSettings)

public virtual Task<BatchUpdateIngressRulesResponse> BatchUpdateIngressRulesAsync(BatchUpdateIngressRulesRequest request, CallSettings callSettings = null)

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
Name Description
request BatchUpdateIngressRulesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskBatchUpdateIngressRulesResponse

A Task containing the RPC response.

Example
// Create client
FirewallClient firewallClient = await FirewallClient.CreateAsync();
// Initialize request argument(s)
BatchUpdateIngressRulesRequest request = new BatchUpdateIngressRulesRequest
{
    Name = "",
    IngressRules = { new FirewallRule(), },
};
// Make the request
BatchUpdateIngressRulesResponse response = await firewallClient.BatchUpdateIngressRulesAsync(request);

BatchUpdateIngressRulesAsync(BatchUpdateIngressRulesRequest, CancellationToken)

public virtual Task<BatchUpdateIngressRulesResponse> BatchUpdateIngressRulesAsync(BatchUpdateIngressRulesRequest request, CancellationToken cancellationToken)

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
Name Description
request BatchUpdateIngressRulesRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskBatchUpdateIngressRulesResponse

A Task containing the RPC response.

Example
// Create client
FirewallClient firewallClient = await FirewallClient.CreateAsync();
// Initialize request argument(s)
BatchUpdateIngressRulesRequest request = new BatchUpdateIngressRulesRequest
{
    Name = "",
    IngressRules = { new FirewallRule(), },
};
// Make the request
BatchUpdateIngressRulesResponse response = await firewallClient.BatchUpdateIngressRulesAsync(request);

Create()

public static FirewallClient Create()

Synchronously creates a FirewallClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use FirewallClientBuilder.

Returns
Type Description
FirewallClient

The created FirewallClient.

CreateAsync(CancellationToken)

public static Task<FirewallClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a FirewallClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use FirewallClientBuilder.

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskFirewallClient

The task representing the created FirewallClient.

CreateIngressRule(CreateIngressRuleRequest, CallSettings)

public virtual FirewallRule CreateIngressRule(CreateIngressRuleRequest request, CallSettings callSettings = null)

Creates a firewall rule for the application.

Parameters
Name Description
request CreateIngressRuleRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
FirewallRule

The RPC response.

Example
// Create client
FirewallClient firewallClient = FirewallClient.Create();
// Initialize request argument(s)
CreateIngressRuleRequest request = new CreateIngressRuleRequest
{
    Parent = "",
    Rule = new FirewallRule(),
};
// Make the request
FirewallRule response = firewallClient.CreateIngressRule(request);

CreateIngressRuleAsync(CreateIngressRuleRequest, CallSettings)

public virtual Task<FirewallRule> CreateIngressRuleAsync(CreateIngressRuleRequest request, CallSettings callSettings = null)

Creates a firewall rule for the application.

Parameters
Name Description
request CreateIngressRuleRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskFirewallRule

A Task containing the RPC response.

Example
// Create client
FirewallClient firewallClient = await FirewallClient.CreateAsync();
// Initialize request argument(s)
CreateIngressRuleRequest request = new CreateIngressRuleRequest
{
    Parent = "",
    Rule = new FirewallRule(),
};
// Make the request
FirewallRule response = await firewallClient.CreateIngressRuleAsync(request);

CreateIngressRuleAsync(CreateIngressRuleRequest, CancellationToken)

public virtual Task<FirewallRule> CreateIngressRuleAsync(CreateIngressRuleRequest request, CancellationToken cancellationToken)

Creates a firewall rule for the application.

Parameters
Name Description
request CreateIngressRuleRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskFirewallRule

A Task containing the RPC response.

Example
// Create client
FirewallClient firewallClient = await FirewallClient.CreateAsync();
// Initialize request argument(s)
CreateIngressRuleRequest request = new CreateIngressRuleRequest
{
    Parent = "",
    Rule = new FirewallRule(),
};
// Make the request
FirewallRule response = await firewallClient.CreateIngressRuleAsync(request);

DeleteIngressRule(DeleteIngressRuleRequest, CallSettings)

public virtual void DeleteIngressRule(DeleteIngressRuleRequest request, CallSettings callSettings = null)

Deletes the specified firewall rule.

Parameters
Name Description
request DeleteIngressRuleRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
FirewallClient firewallClient = FirewallClient.Create();
// Initialize request argument(s)
DeleteIngressRuleRequest request = new DeleteIngressRuleRequest { Name = "", };
// Make the request
firewallClient.DeleteIngressRule(request);

DeleteIngressRuleAsync(DeleteIngressRuleRequest, CallSettings)

public virtual Task DeleteIngressRuleAsync(DeleteIngressRuleRequest request, CallSettings callSettings = null)

Deletes the specified firewall rule.

Parameters
Name Description
request DeleteIngressRuleRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
FirewallClient firewallClient = await FirewallClient.CreateAsync();
// Initialize request argument(s)
DeleteIngressRuleRequest request = new DeleteIngressRuleRequest { Name = "", };
// Make the request
await firewallClient.DeleteIngressRuleAsync(request);

DeleteIngressRuleAsync(DeleteIngressRuleRequest, CancellationToken)

public virtual Task DeleteIngressRuleAsync(DeleteIngressRuleRequest request, CancellationToken cancellationToken)

Deletes the specified firewall rule.

Parameters
Name Description
request DeleteIngressRuleRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
FirewallClient firewallClient = await FirewallClient.CreateAsync();
// Initialize request argument(s)
DeleteIngressRuleRequest request = new DeleteIngressRuleRequest { Name = "", };
// Make the request
await firewallClient.DeleteIngressRuleAsync(request);

GetIngressRule(GetIngressRuleRequest, CallSettings)

public virtual FirewallRule GetIngressRule(GetIngressRuleRequest request, CallSettings callSettings = null)

Gets the specified firewall rule.

Parameters
Name Description
request GetIngressRuleRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
FirewallRule

The RPC response.

Example
// Create client
FirewallClient firewallClient = FirewallClient.Create();
// Initialize request argument(s)
GetIngressRuleRequest request = new GetIngressRuleRequest { Name = "", };
// Make the request
FirewallRule response = firewallClient.GetIngressRule(request);

GetIngressRuleAsync(GetIngressRuleRequest, CallSettings)

public virtual Task<FirewallRule> GetIngressRuleAsync(GetIngressRuleRequest request, CallSettings callSettings = null)

Gets the specified firewall rule.

Parameters
Name Description
request GetIngressRuleRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskFirewallRule

A Task containing the RPC response.

Example
// Create client
FirewallClient firewallClient = await FirewallClient.CreateAsync();
// Initialize request argument(s)
GetIngressRuleRequest request = new GetIngressRuleRequest { Name = "", };
// Make the request
FirewallRule response = await firewallClient.GetIngressRuleAsync(request);

GetIngressRuleAsync(GetIngressRuleRequest, CancellationToken)

public virtual Task<FirewallRule> GetIngressRuleAsync(GetIngressRuleRequest request, CancellationToken cancellationToken)

Gets the specified firewall rule.

Parameters
Name Description
request GetIngressRuleRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskFirewallRule

A Task containing the RPC response.

Example
// Create client
FirewallClient firewallClient = await FirewallClient.CreateAsync();
// Initialize request argument(s)
GetIngressRuleRequest request = new GetIngressRuleRequest { Name = "", };
// Make the request
FirewallRule response = await firewallClient.GetIngressRuleAsync(request);

ListIngressRules(ListIngressRulesRequest, CallSettings)

public virtual PagedEnumerable<ListIngressRulesResponse, FirewallRule> ListIngressRules(ListIngressRulesRequest request, CallSettings callSettings = null)

Lists the firewall rules of an application.

Parameters
Name Description
request ListIngressRulesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListIngressRulesResponseFirewallRule

A pageable sequence of FirewallRule resources.

Example
// Create client
FirewallClient firewallClient = FirewallClient.Create();
// Initialize request argument(s)
ListIngressRulesRequest request = new ListIngressRulesRequest
{
    Parent = "",
    MatchingAddress = "",
};
// Make the request
PagedEnumerable<ListIngressRulesResponse, FirewallRule> response = firewallClient.ListIngressRules(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (FirewallRule item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListIngressRulesResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (FirewallRule item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<FirewallRule> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (FirewallRule item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListIngressRulesAsync(ListIngressRulesRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListIngressRulesResponse, FirewallRule> ListIngressRulesAsync(ListIngressRulesRequest request, CallSettings callSettings = null)

Lists the firewall rules of an application.

Parameters
Name Description
request ListIngressRulesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListIngressRulesResponseFirewallRule

A pageable asynchronous sequence of FirewallRule resources.

Example
// Create client
FirewallClient firewallClient = await FirewallClient.CreateAsync();
// Initialize request argument(s)
ListIngressRulesRequest request = new ListIngressRulesRequest
{
    Parent = "",
    MatchingAddress = "",
};
// Make the request
PagedAsyncEnumerable<ListIngressRulesResponse, FirewallRule> response = firewallClient.ListIngressRulesAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((FirewallRule item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListIngressRulesResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (FirewallRule item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<FirewallRule> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (FirewallRule item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
Type Description
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.

UpdateIngressRule(UpdateIngressRuleRequest, CallSettings)

public virtual FirewallRule UpdateIngressRule(UpdateIngressRuleRequest request, CallSettings callSettings = null)

Updates the specified firewall rule.

Parameters
Name Description
request UpdateIngressRuleRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
FirewallRule

The RPC response.

Example
// Create client
FirewallClient firewallClient = FirewallClient.Create();
// Initialize request argument(s)
UpdateIngressRuleRequest request = new UpdateIngressRuleRequest
{
    Name = "",
    Rule = new FirewallRule(),
    UpdateMask = new FieldMask(),
};
// Make the request
FirewallRule response = firewallClient.UpdateIngressRule(request);

UpdateIngressRuleAsync(UpdateIngressRuleRequest, CallSettings)

public virtual Task<FirewallRule> UpdateIngressRuleAsync(UpdateIngressRuleRequest request, CallSettings callSettings = null)

Updates the specified firewall rule.

Parameters
Name Description
request UpdateIngressRuleRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskFirewallRule

A Task containing the RPC response.

Example
// Create client
FirewallClient firewallClient = await FirewallClient.CreateAsync();
// Initialize request argument(s)
UpdateIngressRuleRequest request = new UpdateIngressRuleRequest
{
    Name = "",
    Rule = new FirewallRule(),
    UpdateMask = new FieldMask(),
};
// Make the request
FirewallRule response = await firewallClient.UpdateIngressRuleAsync(request);

UpdateIngressRuleAsync(UpdateIngressRuleRequest, CancellationToken)

public virtual Task<FirewallRule> UpdateIngressRuleAsync(UpdateIngressRuleRequest request, CancellationToken cancellationToken)

Updates the specified firewall rule.

Parameters
Name Description
request UpdateIngressRuleRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskFirewallRule

A Task containing the RPC response.

Example
// Create client
FirewallClient firewallClient = await FirewallClient.CreateAsync();
// Initialize request argument(s)
UpdateIngressRuleRequest request = new UpdateIngressRuleRequest
{
    Name = "",
    Rule = new FirewallRule(),
    UpdateMask = new FieldMask(),
};
// Make the request
FirewallRule response = await firewallClient.UpdateIngressRuleAsync(request);