Class NetworkSecurityClient (0.7.0)

publicclass NetworkSecurityClientimplementsBackgroundResource

Service Description: Network Security API provides resources to configure authentication and authorization policies. Refer to per API resource documentation for more information.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
AuthorizationPolicyNamename=
AuthorizationPolicyName.of("[PROJECT]","[LOCATION]","[AUTHORIZATION_POLICY]");
AuthorizationPolicyresponse=networkSecurityClient.getAuthorizationPolicy(name);
}

Note: close() needs to be called on the NetworkSecurityClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of NetworkSecuritySettings to create(). For example:

To customize credentials:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
NetworkSecuritySettingsnetworkSecuritySettings=
NetworkSecuritySettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
NetworkSecurityClientnetworkSecurityClient=
NetworkSecurityClient.create(networkSecuritySettings);

To customize the endpoint:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
NetworkSecuritySettingsnetworkSecuritySettings=
NetworkSecuritySettings.newBuilder().setEndpoint(myEndpoint).build();
NetworkSecurityClientnetworkSecurityClient=
NetworkSecurityClient.create(networkSecuritySettings);

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > NetworkSecurityClient

Implements

BackgroundResource

Static Methods

create()

publicstaticfinalNetworkSecurityClientcreate()

Constructs an instance of NetworkSecurityClient with default settings.

Returns
Type Description
Exceptions
Type Description

create(NetworkSecuritySettings settings)

publicstaticfinalNetworkSecurityClientcreate(NetworkSecuritySettingssettings)

Constructs an instance of NetworkSecurityClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
Name Description
Returns
Type Description
Exceptions
Type Description

create(NetworkSecurityStub stub)

publicstaticfinalNetworkSecurityClientcreate(NetworkSecurityStubstub)

Constructs an instance of NetworkSecurityClient, using the given stub for making calls. This is for advanced usage - prefer using create(NetworkSecuritySettings).

Parameter
Name Description
Returns
Type Description

Constructors

NetworkSecurityClient(NetworkSecuritySettings settings)

protectedNetworkSecurityClient(NetworkSecuritySettingssettings)

Constructs an instance of NetworkSecurityClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
Name Description

NetworkSecurityClient(NetworkSecurityStub stub)

protectedNetworkSecurityClient(NetworkSecurityStubstub)
Parameter
Name Description

Methods

awaitTermination(long duration, TimeUnit unit)

publicbooleanawaitTermination(longduration,TimeUnitunit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
Exceptions
Type Description

close()

publicfinalvoidclose()

createAuthorizationPolicyAsync(CreateAuthorizationPolicyRequest request)

publicfinalOperationFuture<AuthorizationPolicy,OperationMetadata>createAuthorizationPolicyAsync(CreateAuthorizationPolicyRequestrequest)

Creates a new AuthorizationPolicy in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
CreateAuthorizationPolicyRequestrequest=
CreateAuthorizationPolicyRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setAuthorizationPolicyId("authorizationPolicyId1314252166")
.setAuthorizationPolicy(AuthorizationPolicy.newBuilder().build())
.build();
AuthorizationPolicyresponse=
networkSecurityClient.createAuthorizationPolicyAsync(request).get();
}
Parameter
Name Description
request CreateAuthorizationPolicyRequest

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

Returns
Type Description

createAuthorizationPolicyAsync(LocationName parent, AuthorizationPolicy authorizationPolicy, String authorizationPolicyId)

publicfinalOperationFuture<AuthorizationPolicy,OperationMetadata>createAuthorizationPolicyAsync(LocationNameparent,AuthorizationPolicyauthorizationPolicy,StringauthorizationPolicyId)

Creates a new AuthorizationPolicy in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
LocationNameparent=LocationName.of("[PROJECT]","[LOCATION]");
AuthorizationPolicyauthorizationPolicy=AuthorizationPolicy.newBuilder().build();
StringauthorizationPolicyId="authorizationPolicyId1314252166";
AuthorizationPolicyresponse=
networkSecurityClient
.createAuthorizationPolicyAsync(parent,authorizationPolicy,authorizationPolicyId)
.get();
}
Parameters
Name Description
parent LocationName

Required. The parent resource of the AuthorizationPolicy. Must be in the format projects/{project}/locations/{location}.

authorizationPolicy AuthorizationPolicy

Required. AuthorizationPolicy resource to be created.

authorizationPolicyId String

Required. Short name of the AuthorizationPolicy resource to be created. This value should be 1-63 characters long, containing only letters, numbers, hyphens, and underscores, and should not start with a number. E.g. "authz_policy".

Returns
Type Description

createAuthorizationPolicyAsync(String parent, AuthorizationPolicy authorizationPolicy, String authorizationPolicyId)

publicfinalOperationFuture<AuthorizationPolicy,OperationMetadata>createAuthorizationPolicyAsync(Stringparent,AuthorizationPolicyauthorizationPolicy,StringauthorizationPolicyId)

Creates a new AuthorizationPolicy in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
Stringparent=LocationName.of("[PROJECT]","[LOCATION]").toString();
AuthorizationPolicyauthorizationPolicy=AuthorizationPolicy.newBuilder().build();
StringauthorizationPolicyId="authorizationPolicyId1314252166";
AuthorizationPolicyresponse=
networkSecurityClient
.createAuthorizationPolicyAsync(parent,authorizationPolicy,authorizationPolicyId)
.get();
}
Parameters
Name Description
parent String

Required. The parent resource of the AuthorizationPolicy. Must be in the format projects/{project}/locations/{location}.

authorizationPolicy AuthorizationPolicy

Required. AuthorizationPolicy resource to be created.

authorizationPolicyId String

Required. Short name of the AuthorizationPolicy resource to be created. This value should be 1-63 characters long, containing only letters, numbers, hyphens, and underscores, and should not start with a number. E.g. "authz_policy".

Returns
Type Description

createAuthorizationPolicyCallable()

publicfinalUnaryCallable<CreateAuthorizationPolicyRequest,Operation>createAuthorizationPolicyCallable()

Creates a new AuthorizationPolicy in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
CreateAuthorizationPolicyRequestrequest=
CreateAuthorizationPolicyRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setAuthorizationPolicyId("authorizationPolicyId1314252166")
.setAuthorizationPolicy(AuthorizationPolicy.newBuilder().build())
.build();
ApiFuture<Operation>future=
networkSecurityClient.createAuthorizationPolicyCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
Returns
Type Description

createAuthorizationPolicyOperationCallable()

publicfinalOperationCallable<CreateAuthorizationPolicyRequest,AuthorizationPolicy,OperationMetadata>createAuthorizationPolicyOperationCallable()

Creates a new AuthorizationPolicy in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
CreateAuthorizationPolicyRequestrequest=
CreateAuthorizationPolicyRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setAuthorizationPolicyId("authorizationPolicyId1314252166")
.setAuthorizationPolicy(AuthorizationPolicy.newBuilder().build())
.build();
OperationFuture<AuthorizationPolicy,OperationMetadata>future=
networkSecurityClient.createAuthorizationPolicyOperationCallable().futureCall(request);
// Do something.
AuthorizationPolicyresponse=future.get();
}
Returns
Type Description

createClientTlsPolicyAsync(CreateClientTlsPolicyRequest request)

publicfinalOperationFuture<ClientTlsPolicy,OperationMetadata>createClientTlsPolicyAsync(CreateClientTlsPolicyRequestrequest)

Creates a new ClientTlsPolicy in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
CreateClientTlsPolicyRequestrequest=
CreateClientTlsPolicyRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setClientTlsPolicyId("clientTlsPolicyId-188933315")
.setClientTlsPolicy(ClientTlsPolicy.newBuilder().build())
.build();
ClientTlsPolicyresponse=networkSecurityClient.createClientTlsPolicyAsync(request).get();
}
Parameter
Name Description
request CreateClientTlsPolicyRequest

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

Returns
Type Description

createClientTlsPolicyAsync(LocationName parent, ClientTlsPolicy clientTlsPolicy, String clientTlsPolicyId)

publicfinalOperationFuture<ClientTlsPolicy,OperationMetadata>createClientTlsPolicyAsync(LocationNameparent,ClientTlsPolicyclientTlsPolicy,StringclientTlsPolicyId)

Creates a new ClientTlsPolicy in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
LocationNameparent=LocationName.of("[PROJECT]","[LOCATION]");
ClientTlsPolicyclientTlsPolicy=ClientTlsPolicy.newBuilder().build();
StringclientTlsPolicyId="clientTlsPolicyId-188933315";
ClientTlsPolicyresponse=
networkSecurityClient
.createClientTlsPolicyAsync(parent,clientTlsPolicy,clientTlsPolicyId)
.get();
}
Parameters
Name Description
parent LocationName

Required. The parent resource of the ClientTlsPolicy. Must be in the format projects/*/locations/{location}.

clientTlsPolicy ClientTlsPolicy

Required. ClientTlsPolicy resource to be created.

clientTlsPolicyId String

Required. Short name of the ClientTlsPolicy resource to be created. This value should be 1-63 characters long, containing only letters, numbers, hyphens, and underscores, and should not start with a number. E.g. "client_mtls_policy".

Returns
Type Description

createClientTlsPolicyAsync(String parent, ClientTlsPolicy clientTlsPolicy, String clientTlsPolicyId)

publicfinalOperationFuture<ClientTlsPolicy,OperationMetadata>createClientTlsPolicyAsync(Stringparent,ClientTlsPolicyclientTlsPolicy,StringclientTlsPolicyId)

Creates a new ClientTlsPolicy in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
Stringparent=LocationName.of("[PROJECT]","[LOCATION]").toString();
ClientTlsPolicyclientTlsPolicy=ClientTlsPolicy.newBuilder().build();
StringclientTlsPolicyId="clientTlsPolicyId-188933315";
ClientTlsPolicyresponse=
networkSecurityClient
.createClientTlsPolicyAsync(parent,clientTlsPolicy,clientTlsPolicyId)
.get();
}
Parameters
Name Description
parent String

Required. The parent resource of the ClientTlsPolicy. Must be in the format projects/*/locations/{location}.

clientTlsPolicy ClientTlsPolicy

Required. ClientTlsPolicy resource to be created.

clientTlsPolicyId String

Required. Short name of the ClientTlsPolicy resource to be created. This value should be 1-63 characters long, containing only letters, numbers, hyphens, and underscores, and should not start with a number. E.g. "client_mtls_policy".

Returns
Type Description

createClientTlsPolicyCallable()

publicfinalUnaryCallable<CreateClientTlsPolicyRequest,Operation>createClientTlsPolicyCallable()

Creates a new ClientTlsPolicy in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
CreateClientTlsPolicyRequestrequest=
CreateClientTlsPolicyRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setClientTlsPolicyId("clientTlsPolicyId-188933315")
.setClientTlsPolicy(ClientTlsPolicy.newBuilder().build())
.build();
ApiFuture<Operation>future=
networkSecurityClient.createClientTlsPolicyCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
Returns
Type Description

createClientTlsPolicyOperationCallable()

publicfinalOperationCallable<CreateClientTlsPolicyRequest,ClientTlsPolicy,OperationMetadata>createClientTlsPolicyOperationCallable()

Creates a new ClientTlsPolicy in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
CreateClientTlsPolicyRequestrequest=
CreateClientTlsPolicyRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setClientTlsPolicyId("clientTlsPolicyId-188933315")
.setClientTlsPolicy(ClientTlsPolicy.newBuilder().build())
.build();
OperationFuture<ClientTlsPolicy,OperationMetadata>future=
networkSecurityClient.createClientTlsPolicyOperationCallable().futureCall(request);
// Do something.
ClientTlsPolicyresponse=future.get();
}
Returns
Type Description

createServerTlsPolicyAsync(CreateServerTlsPolicyRequest request)

publicfinalOperationFuture<ServerTlsPolicy,OperationMetadata>createServerTlsPolicyAsync(CreateServerTlsPolicyRequestrequest)

Creates a new ServerTlsPolicy in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
CreateServerTlsPolicyRequestrequest=
CreateServerTlsPolicyRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setServerTlsPolicyId("serverTlsPolicyId-1966046011")
.setServerTlsPolicy(ServerTlsPolicy.newBuilder().build())
.build();
ServerTlsPolicyresponse=networkSecurityClient.createServerTlsPolicyAsync(request).get();
}
Parameter
Name Description
request CreateServerTlsPolicyRequest

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

Returns
Type Description

createServerTlsPolicyAsync(LocationName parent, ServerTlsPolicy serverTlsPolicy, String serverTlsPolicyId)

publicfinalOperationFuture<ServerTlsPolicy,OperationMetadata>createServerTlsPolicyAsync(LocationNameparent,ServerTlsPolicyserverTlsPolicy,StringserverTlsPolicyId)

Creates a new ServerTlsPolicy in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
LocationNameparent=LocationName.of("[PROJECT]","[LOCATION]");
ServerTlsPolicyserverTlsPolicy=ServerTlsPolicy.newBuilder().build();
StringserverTlsPolicyId="serverTlsPolicyId-1966046011";
ServerTlsPolicyresponse=
networkSecurityClient
.createServerTlsPolicyAsync(parent,serverTlsPolicy,serverTlsPolicyId)
.get();
}
Parameters
Name Description
parent LocationName

Required. The parent resource of the ServerTlsPolicy. Must be in the format projects/*/locations/{location}.

serverTlsPolicy ServerTlsPolicy

Required. ServerTlsPolicy resource to be created.

serverTlsPolicyId String

Required. Short name of the ServerTlsPolicy resource to be created. This value should be 1-63 characters long, containing only letters, numbers, hyphens, and underscores, and should not start with a number. E.g. "server_mtls_policy".

Returns
Type Description

createServerTlsPolicyAsync(String parent, ServerTlsPolicy serverTlsPolicy, String serverTlsPolicyId)

publicfinalOperationFuture<ServerTlsPolicy,OperationMetadata>createServerTlsPolicyAsync(Stringparent,ServerTlsPolicyserverTlsPolicy,StringserverTlsPolicyId)

Creates a new ServerTlsPolicy in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
Stringparent=LocationName.of("[PROJECT]","[LOCATION]").toString();
ServerTlsPolicyserverTlsPolicy=ServerTlsPolicy.newBuilder().build();
StringserverTlsPolicyId="serverTlsPolicyId-1966046011";
ServerTlsPolicyresponse=
networkSecurityClient
.createServerTlsPolicyAsync(parent,serverTlsPolicy,serverTlsPolicyId)
.get();
}
Parameters
Name Description
parent String

Required. The parent resource of the ServerTlsPolicy. Must be in the format projects/*/locations/{location}.

serverTlsPolicy ServerTlsPolicy

Required. ServerTlsPolicy resource to be created.

serverTlsPolicyId String

Required. Short name of the ServerTlsPolicy resource to be created. This value should be 1-63 characters long, containing only letters, numbers, hyphens, and underscores, and should not start with a number. E.g. "server_mtls_policy".

Returns
Type Description

createServerTlsPolicyCallable()

publicfinalUnaryCallable<CreateServerTlsPolicyRequest,Operation>createServerTlsPolicyCallable()

Creates a new ServerTlsPolicy in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
CreateServerTlsPolicyRequestrequest=
CreateServerTlsPolicyRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setServerTlsPolicyId("serverTlsPolicyId-1966046011")
.setServerTlsPolicy(ServerTlsPolicy.newBuilder().build())
.build();
ApiFuture<Operation>future=
networkSecurityClient.createServerTlsPolicyCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
Returns
Type Description

createServerTlsPolicyOperationCallable()

publicfinalOperationCallable<CreateServerTlsPolicyRequest,ServerTlsPolicy,OperationMetadata>createServerTlsPolicyOperationCallable()

Creates a new ServerTlsPolicy in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
CreateServerTlsPolicyRequestrequest=
CreateServerTlsPolicyRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setServerTlsPolicyId("serverTlsPolicyId-1966046011")
.setServerTlsPolicy(ServerTlsPolicy.newBuilder().build())
.build();
OperationFuture<ServerTlsPolicy,OperationMetadata>future=
networkSecurityClient.createServerTlsPolicyOperationCallable().futureCall(request);
// Do something.
ServerTlsPolicyresponse=future.get();
}
Returns
Type Description

deleteAuthorizationPolicyAsync(AuthorizationPolicyName name)

publicfinalOperationFuture<Empty,OperationMetadata>deleteAuthorizationPolicyAsync(AuthorizationPolicyNamename)

Deletes a single AuthorizationPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
AuthorizationPolicyNamename=
AuthorizationPolicyName.of("[PROJECT]","[LOCATION]","[AUTHORIZATION_POLICY]");
networkSecurityClient.deleteAuthorizationPolicyAsync(name).get();
}
Parameter
Name Description
name AuthorizationPolicyName

Required. A name of the AuthorizationPolicy to delete. Must be in the format projects/{project}/locations/{location}/authorizationPolicies/*.

Returns
Type Description

deleteAuthorizationPolicyAsync(DeleteAuthorizationPolicyRequest request)

publicfinalOperationFuture<Empty,OperationMetadata>deleteAuthorizationPolicyAsync(DeleteAuthorizationPolicyRequestrequest)

Deletes a single AuthorizationPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
DeleteAuthorizationPolicyRequestrequest=
DeleteAuthorizationPolicyRequest.newBuilder()
.setName(
AuthorizationPolicyName.of("[PROJECT]","[LOCATION]","[AUTHORIZATION_POLICY]")
.toString())
.build();
networkSecurityClient.deleteAuthorizationPolicyAsync(request).get();
}
Parameter
Name Description
request DeleteAuthorizationPolicyRequest

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

Returns
Type Description

deleteAuthorizationPolicyAsync(String name)

publicfinalOperationFuture<Empty,OperationMetadata>deleteAuthorizationPolicyAsync(Stringname)

Deletes a single AuthorizationPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
Stringname=
AuthorizationPolicyName.of("[PROJECT]","[LOCATION]","[AUTHORIZATION_POLICY]")
.toString();
networkSecurityClient.deleteAuthorizationPolicyAsync(name).get();
}
Parameter
Name Description
name String

Required. A name of the AuthorizationPolicy to delete. Must be in the format projects/{project}/locations/{location}/authorizationPolicies/*.

Returns
Type Description

deleteAuthorizationPolicyCallable()

publicfinalUnaryCallable<DeleteAuthorizationPolicyRequest,Operation>deleteAuthorizationPolicyCallable()

Deletes a single AuthorizationPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
DeleteAuthorizationPolicyRequestrequest=
DeleteAuthorizationPolicyRequest.newBuilder()
.setName(
AuthorizationPolicyName.of("[PROJECT]","[LOCATION]","[AUTHORIZATION_POLICY]")
.toString())
.build();
ApiFuture<Operation>future=
networkSecurityClient.deleteAuthorizationPolicyCallable().futureCall(request);
// Do something.
future.get();
}
Returns
Type Description

deleteAuthorizationPolicyOperationCallable()

publicfinalOperationCallable<DeleteAuthorizationPolicyRequest,Empty,OperationMetadata>deleteAuthorizationPolicyOperationCallable()

Deletes a single AuthorizationPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
DeleteAuthorizationPolicyRequestrequest=
DeleteAuthorizationPolicyRequest.newBuilder()
.setName(
AuthorizationPolicyName.of("[PROJECT]","[LOCATION]","[AUTHORIZATION_POLICY]")
.toString())
.build();
OperationFuture<Empty,OperationMetadata>future=
networkSecurityClient.deleteAuthorizationPolicyOperationCallable().futureCall(request);
// Do something.
future.get();
}
Returns
Type Description

deleteClientTlsPolicyAsync(ClientTlsPolicyName name)

publicfinalOperationFuture<Empty,OperationMetadata>deleteClientTlsPolicyAsync(ClientTlsPolicyNamename)

Deletes a single ClientTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
ClientTlsPolicyNamename=
ClientTlsPolicyName.of("[PROJECT]","[LOCATION]","[CLIENT_TLS_POLICY]");
networkSecurityClient.deleteClientTlsPolicyAsync(name).get();
}
Parameter
Name Description
name ClientTlsPolicyName

Required. A name of the ClientTlsPolicy to delete. Must be in the format projects/*/locations/{location}/clientTlsPolicies/*.

Returns
Type Description

deleteClientTlsPolicyAsync(DeleteClientTlsPolicyRequest request)

publicfinalOperationFuture<Empty,OperationMetadata>deleteClientTlsPolicyAsync(DeleteClientTlsPolicyRequestrequest)

Deletes a single ClientTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
DeleteClientTlsPolicyRequestrequest=
DeleteClientTlsPolicyRequest.newBuilder()
.setName(
ClientTlsPolicyName.of("[PROJECT]","[LOCATION]","[CLIENT_TLS_POLICY]")
.toString())
.build();
networkSecurityClient.deleteClientTlsPolicyAsync(request).get();
}
Parameter
Name Description
request DeleteClientTlsPolicyRequest

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

Returns
Type Description

deleteClientTlsPolicyAsync(String name)

publicfinalOperationFuture<Empty,OperationMetadata>deleteClientTlsPolicyAsync(Stringname)

Deletes a single ClientTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
Stringname=
ClientTlsPolicyName.of("[PROJECT]","[LOCATION]","[CLIENT_TLS_POLICY]").toString();
networkSecurityClient.deleteClientTlsPolicyAsync(name).get();
}
Parameter
Name Description
name String

Required. A name of the ClientTlsPolicy to delete. Must be in the format projects/*/locations/{location}/clientTlsPolicies/*.

Returns
Type Description

deleteClientTlsPolicyCallable()

publicfinalUnaryCallable<DeleteClientTlsPolicyRequest,Operation>deleteClientTlsPolicyCallable()

Deletes a single ClientTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
DeleteClientTlsPolicyRequestrequest=
DeleteClientTlsPolicyRequest.newBuilder()
.setName(
ClientTlsPolicyName.of("[PROJECT]","[LOCATION]","[CLIENT_TLS_POLICY]")
.toString())
.build();
ApiFuture<Operation>future=
networkSecurityClient.deleteClientTlsPolicyCallable().futureCall(request);
// Do something.
future.get();
}
Returns
Type Description

deleteClientTlsPolicyOperationCallable()

publicfinalOperationCallable<DeleteClientTlsPolicyRequest,Empty,OperationMetadata>deleteClientTlsPolicyOperationCallable()

Deletes a single ClientTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
DeleteClientTlsPolicyRequestrequest=
DeleteClientTlsPolicyRequest.newBuilder()
.setName(
ClientTlsPolicyName.of("[PROJECT]","[LOCATION]","[CLIENT_TLS_POLICY]")
.toString())
.build();
OperationFuture<Empty,OperationMetadata>future=
networkSecurityClient.deleteClientTlsPolicyOperationCallable().futureCall(request);
// Do something.
future.get();
}
Returns
Type Description

deleteServerTlsPolicyAsync(DeleteServerTlsPolicyRequest request)

publicfinalOperationFuture<Empty,OperationMetadata>deleteServerTlsPolicyAsync(DeleteServerTlsPolicyRequestrequest)

Deletes a single ServerTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
DeleteServerTlsPolicyRequestrequest=
DeleteServerTlsPolicyRequest.newBuilder()
.setName(
ServerTlsPolicyName.of("[PROJECT]","[LOCATION]","[SERVER_TLS_POLICY]")
.toString())
.build();
networkSecurityClient.deleteServerTlsPolicyAsync(request).get();
}
Parameter
Name Description
request DeleteServerTlsPolicyRequest

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

Returns
Type Description

deleteServerTlsPolicyAsync(ServerTlsPolicyName name)

publicfinalOperationFuture<Empty,OperationMetadata>deleteServerTlsPolicyAsync(ServerTlsPolicyNamename)

Deletes a single ServerTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
ServerTlsPolicyNamename=
ServerTlsPolicyName.of("[PROJECT]","[LOCATION]","[SERVER_TLS_POLICY]");
networkSecurityClient.deleteServerTlsPolicyAsync(name).get();
}
Parameter
Name Description
name ServerTlsPolicyName

Required. A name of the ServerTlsPolicy to delete. Must be in the format projects/*/locations/{location}/serverTlsPolicies/*.

Returns
Type Description

deleteServerTlsPolicyAsync(String name)

publicfinalOperationFuture<Empty,OperationMetadata>deleteServerTlsPolicyAsync(Stringname)

Deletes a single ServerTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
Stringname=
ServerTlsPolicyName.of("[PROJECT]","[LOCATION]","[SERVER_TLS_POLICY]").toString();
networkSecurityClient.deleteServerTlsPolicyAsync(name).get();
}
Parameter
Name Description
name String

Required. A name of the ServerTlsPolicy to delete. Must be in the format projects/*/locations/{location}/serverTlsPolicies/*.

Returns
Type Description

deleteServerTlsPolicyCallable()

publicfinalUnaryCallable<DeleteServerTlsPolicyRequest,Operation>deleteServerTlsPolicyCallable()

Deletes a single ServerTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
DeleteServerTlsPolicyRequestrequest=
DeleteServerTlsPolicyRequest.newBuilder()
.setName(
ServerTlsPolicyName.of("[PROJECT]","[LOCATION]","[SERVER_TLS_POLICY]")
.toString())
.build();
ApiFuture<Operation>future=
networkSecurityClient.deleteServerTlsPolicyCallable().futureCall(request);
// Do something.
future.get();
}
Returns
Type Description

deleteServerTlsPolicyOperationCallable()

publicfinalOperationCallable<DeleteServerTlsPolicyRequest,Empty,OperationMetadata>deleteServerTlsPolicyOperationCallable()

Deletes a single ServerTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
DeleteServerTlsPolicyRequestrequest=
DeleteServerTlsPolicyRequest.newBuilder()
.setName(
ServerTlsPolicyName.of("[PROJECT]","[LOCATION]","[SERVER_TLS_POLICY]")
.toString())
.build();
OperationFuture<Empty,OperationMetadata>future=
networkSecurityClient.deleteServerTlsPolicyOperationCallable().futureCall(request);
// Do something.
future.get();
}
Returns
Type Description

getAuthorizationPolicy(AuthorizationPolicyName name)

publicfinalAuthorizationPolicygetAuthorizationPolicy(AuthorizationPolicyNamename)

Gets details of a single AuthorizationPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
AuthorizationPolicyNamename=
AuthorizationPolicyName.of("[PROJECT]","[LOCATION]","[AUTHORIZATION_POLICY]");
AuthorizationPolicyresponse=networkSecurityClient.getAuthorizationPolicy(name);
}
Parameter
Name Description
name AuthorizationPolicyName

Required. A name of the AuthorizationPolicy to get. Must be in the format projects/{project}/locations/{location}/authorizationPolicies/*.

Returns
Type Description

getAuthorizationPolicy(GetAuthorizationPolicyRequest request)

publicfinalAuthorizationPolicygetAuthorizationPolicy(GetAuthorizationPolicyRequestrequest)

Gets details of a single AuthorizationPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
GetAuthorizationPolicyRequestrequest=
GetAuthorizationPolicyRequest.newBuilder()
.setName(
AuthorizationPolicyName.of("[PROJECT]","[LOCATION]","[AUTHORIZATION_POLICY]")
.toString())
.build();
AuthorizationPolicyresponse=networkSecurityClient.getAuthorizationPolicy(request);
}
Parameter
Name Description
request GetAuthorizationPolicyRequest

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

Returns
Type Description

getAuthorizationPolicy(String name)

publicfinalAuthorizationPolicygetAuthorizationPolicy(Stringname)

Gets details of a single AuthorizationPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
Stringname=
AuthorizationPolicyName.of("[PROJECT]","[LOCATION]","[AUTHORIZATION_POLICY]")
.toString();
AuthorizationPolicyresponse=networkSecurityClient.getAuthorizationPolicy(name);
}
Parameter
Name Description
name String

Required. A name of the AuthorizationPolicy to get. Must be in the format projects/{project}/locations/{location}/authorizationPolicies/*.

Returns
Type Description

getAuthorizationPolicyCallable()

publicfinalUnaryCallable<GetAuthorizationPolicyRequest,AuthorizationPolicy>getAuthorizationPolicyCallable()

Gets details of a single AuthorizationPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
GetAuthorizationPolicyRequestrequest=
GetAuthorizationPolicyRequest.newBuilder()
.setName(
AuthorizationPolicyName.of("[PROJECT]","[LOCATION]","[AUTHORIZATION_POLICY]")
.toString())
.build();
ApiFuture<AuthorizationPolicy>future=
networkSecurityClient.getAuthorizationPolicyCallable().futureCall(request);
// Do something.
AuthorizationPolicyresponse=future.get();
}
Returns
Type Description

getClientTlsPolicy(ClientTlsPolicyName name)

publicfinalClientTlsPolicygetClientTlsPolicy(ClientTlsPolicyNamename)

Gets details of a single ClientTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
ClientTlsPolicyNamename=
ClientTlsPolicyName.of("[PROJECT]","[LOCATION]","[CLIENT_TLS_POLICY]");
ClientTlsPolicyresponse=networkSecurityClient.getClientTlsPolicy(name);
}
Parameter
Name Description
name ClientTlsPolicyName

Required. A name of the ClientTlsPolicy to get. Must be in the format projects/*/locations/{location}/clientTlsPolicies/*.

Returns
Type Description

getClientTlsPolicy(GetClientTlsPolicyRequest request)

publicfinalClientTlsPolicygetClientTlsPolicy(GetClientTlsPolicyRequestrequest)

Gets details of a single ClientTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
GetClientTlsPolicyRequestrequest=
GetClientTlsPolicyRequest.newBuilder()
.setName(
ClientTlsPolicyName.of("[PROJECT]","[LOCATION]","[CLIENT_TLS_POLICY]")
.toString())
.build();
ClientTlsPolicyresponse=networkSecurityClient.getClientTlsPolicy(request);
}
Parameter
Name Description
request GetClientTlsPolicyRequest

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

Returns
Type Description

getClientTlsPolicy(String name)

publicfinalClientTlsPolicygetClientTlsPolicy(Stringname)

Gets details of a single ClientTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
Stringname=
ClientTlsPolicyName.of("[PROJECT]","[LOCATION]","[CLIENT_TLS_POLICY]").toString();
ClientTlsPolicyresponse=networkSecurityClient.getClientTlsPolicy(name);
}
Parameter
Name Description
name String

Required. A name of the ClientTlsPolicy to get. Must be in the format projects/*/locations/{location}/clientTlsPolicies/*.

Returns
Type Description

getClientTlsPolicyCallable()

publicfinalUnaryCallable<GetClientTlsPolicyRequest,ClientTlsPolicy>getClientTlsPolicyCallable()

Gets details of a single ClientTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
GetClientTlsPolicyRequestrequest=
GetClientTlsPolicyRequest.newBuilder()
.setName(
ClientTlsPolicyName.of("[PROJECT]","[LOCATION]","[CLIENT_TLS_POLICY]")
.toString())
.build();
ApiFuture<ClientTlsPolicy>future=
networkSecurityClient.getClientTlsPolicyCallable().futureCall(request);
// Do something.
ClientTlsPolicyresponse=future.get();
}
Returns
Type Description

getOperationsClient()

publicfinalOperationsClientgetOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description

getServerTlsPolicy(GetServerTlsPolicyRequest request)

publicfinalServerTlsPolicygetServerTlsPolicy(GetServerTlsPolicyRequestrequest)

Gets details of a single ServerTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
GetServerTlsPolicyRequestrequest=
GetServerTlsPolicyRequest.newBuilder()
.setName(
ServerTlsPolicyName.of("[PROJECT]","[LOCATION]","[SERVER_TLS_POLICY]")
.toString())
.build();
ServerTlsPolicyresponse=networkSecurityClient.getServerTlsPolicy(request);
}
Parameter
Name Description
request GetServerTlsPolicyRequest

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

Returns
Type Description

getServerTlsPolicy(ServerTlsPolicyName name)

publicfinalServerTlsPolicygetServerTlsPolicy(ServerTlsPolicyNamename)

Gets details of a single ServerTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
ServerTlsPolicyNamename=
ServerTlsPolicyName.of("[PROJECT]","[LOCATION]","[SERVER_TLS_POLICY]");
ServerTlsPolicyresponse=networkSecurityClient.getServerTlsPolicy(name);
}
Parameter
Name Description
name ServerTlsPolicyName

Required. A name of the ServerTlsPolicy to get. Must be in the format projects/*/locations/{location}/serverTlsPolicies/*.

Returns
Type Description

getServerTlsPolicy(String name)

publicfinalServerTlsPolicygetServerTlsPolicy(Stringname)

Gets details of a single ServerTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
Stringname=
ServerTlsPolicyName.of("[PROJECT]","[LOCATION]","[SERVER_TLS_POLICY]").toString();
ServerTlsPolicyresponse=networkSecurityClient.getServerTlsPolicy(name);
}
Parameter
Name Description
name String

Required. A name of the ServerTlsPolicy to get. Must be in the format projects/*/locations/{location}/serverTlsPolicies/*.

Returns
Type Description

getServerTlsPolicyCallable()

publicfinalUnaryCallable<GetServerTlsPolicyRequest,ServerTlsPolicy>getServerTlsPolicyCallable()

Gets details of a single ServerTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
GetServerTlsPolicyRequestrequest=
GetServerTlsPolicyRequest.newBuilder()
.setName(
ServerTlsPolicyName.of("[PROJECT]","[LOCATION]","[SERVER_TLS_POLICY]")
.toString())
.build();
ApiFuture<ServerTlsPolicy>future=
networkSecurityClient.getServerTlsPolicyCallable().futureCall(request);
// Do something.
ServerTlsPolicyresponse=future.get();
}
Returns
Type Description

getSettings()

publicfinalNetworkSecuritySettingsgetSettings()
Returns
Type Description

getStub()

publicNetworkSecurityStubgetStub()
Returns
Type Description

isShutdown()

publicbooleanisShutdown()
Returns
Type Description

isTerminated()

publicbooleanisTerminated()
Returns
Type Description

listAuthorizationPolicies(ListAuthorizationPoliciesRequest request)

publicfinalNetworkSecurityClient.ListAuthorizationPoliciesPagedResponselistAuthorizationPolicies(ListAuthorizationPoliciesRequestrequest)

Lists AuthorizationPolicies in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
ListAuthorizationPoliciesRequestrequest=
ListAuthorizationPoliciesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for(AuthorizationPolicyelement:
networkSecurityClient.listAuthorizationPolicies(request).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
request ListAuthorizationPoliciesRequest

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

Returns
Type Description

listAuthorizationPolicies(LocationName parent)

publicfinalNetworkSecurityClient.ListAuthorizationPoliciesPagedResponselistAuthorizationPolicies(LocationNameparent)

Lists AuthorizationPolicies in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
LocationNameparent=LocationName.of("[PROJECT]","[LOCATION]");
for(AuthorizationPolicyelement:
networkSecurityClient.listAuthorizationPolicies(parent).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
parent LocationName

Required. The project and location from which the AuthorizationPolicies should be listed, specified in the format projects/{project}/locations/{location}.

Returns
Type Description

listAuthorizationPolicies(String parent)

publicfinalNetworkSecurityClient.ListAuthorizationPoliciesPagedResponselistAuthorizationPolicies(Stringparent)

Lists AuthorizationPolicies in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
Stringparent=LocationName.of("[PROJECT]","[LOCATION]").toString();
for(AuthorizationPolicyelement:
networkSecurityClient.listAuthorizationPolicies(parent).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
parent String

Required. The project and location from which the AuthorizationPolicies should be listed, specified in the format projects/{project}/locations/{location}.

Returns
Type Description

listAuthorizationPoliciesCallable()

publicfinalUnaryCallable<ListAuthorizationPoliciesRequest,ListAuthorizationPoliciesResponse>listAuthorizationPoliciesCallable()

Lists AuthorizationPolicies in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
ListAuthorizationPoliciesRequestrequest=
ListAuthorizationPoliciesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while(true){
ListAuthorizationPoliciesResponseresponse=
networkSecurityClient.listAuthorizationPoliciesCallable().call(request);
for(AuthorizationPolicyelement:response.getAuthorizationPoliciesList()){
// doThingsWith(element);
}
StringnextPageToken=response.getNextPageToken();
if(!Strings.isNullOrEmpty(nextPageToken)){
request=request.toBuilder().setPageToken(nextPageToken).build();
}else{
break;
}
}
}
Returns
Type Description

listAuthorizationPoliciesPagedCallable()

publicfinalUnaryCallable<ListAuthorizationPoliciesRequest,NetworkSecurityClient.ListAuthorizationPoliciesPagedResponse>listAuthorizationPoliciesPagedCallable()

Lists AuthorizationPolicies in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
ListAuthorizationPoliciesRequestrequest=
ListAuthorizationPoliciesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<AuthorizationPolicy>future=
networkSecurityClient.listAuthorizationPoliciesPagedCallable().futureCall(request);
// Do something.
for(AuthorizationPolicyelement:future.get().iterateAll()){
// doThingsWith(element);
}
}
Returns
Type Description

listClientTlsPolicies(ListClientTlsPoliciesRequest request)

publicfinalNetworkSecurityClient.ListClientTlsPoliciesPagedResponselistClientTlsPolicies(ListClientTlsPoliciesRequestrequest)

Lists ClientTlsPolicies in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
ListClientTlsPoliciesRequestrequest=
ListClientTlsPoliciesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for(ClientTlsPolicyelement:
networkSecurityClient.listClientTlsPolicies(request).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
request ListClientTlsPoliciesRequest

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

Returns
Type Description

listClientTlsPolicies(LocationName parent)

publicfinalNetworkSecurityClient.ListClientTlsPoliciesPagedResponselistClientTlsPolicies(LocationNameparent)

Lists ClientTlsPolicies in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
LocationNameparent=LocationName.of("[PROJECT]","[LOCATION]");
for(ClientTlsPolicyelement:
networkSecurityClient.listClientTlsPolicies(parent).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
parent LocationName

Required. The project and location from which the ClientTlsPolicies should be listed, specified in the format projects/*/locations/{location}.

Returns
Type Description

listClientTlsPolicies(String parent)

publicfinalNetworkSecurityClient.ListClientTlsPoliciesPagedResponselistClientTlsPolicies(Stringparent)

Lists ClientTlsPolicies in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
Stringparent=LocationName.of("[PROJECT]","[LOCATION]").toString();
for(ClientTlsPolicyelement:
networkSecurityClient.listClientTlsPolicies(parent).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
parent String

Required. The project and location from which the ClientTlsPolicies should be listed, specified in the format projects/*/locations/{location}.

Returns
Type Description

listClientTlsPoliciesCallable()

publicfinalUnaryCallable<ListClientTlsPoliciesRequest,ListClientTlsPoliciesResponse>listClientTlsPoliciesCallable()

Lists ClientTlsPolicies in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
ListClientTlsPoliciesRequestrequest=
ListClientTlsPoliciesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while(true){
ListClientTlsPoliciesResponseresponse=
networkSecurityClient.listClientTlsPoliciesCallable().call(request);
for(ClientTlsPolicyelement:response.getClientTlsPoliciesList()){
// doThingsWith(element);
}
StringnextPageToken=response.getNextPageToken();
if(!Strings.isNullOrEmpty(nextPageToken)){
request=request.toBuilder().setPageToken(nextPageToken).build();
}else{
break;
}
}
}
Returns
Type Description

listClientTlsPoliciesPagedCallable()

publicfinalUnaryCallable<ListClientTlsPoliciesRequest,NetworkSecurityClient.ListClientTlsPoliciesPagedResponse>listClientTlsPoliciesPagedCallable()

Lists ClientTlsPolicies in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
ListClientTlsPoliciesRequestrequest=
ListClientTlsPoliciesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<ClientTlsPolicy>future=
networkSecurityClient.listClientTlsPoliciesPagedCallable().futureCall(request);
// Do something.
for(ClientTlsPolicyelement:future.get().iterateAll()){
// doThingsWith(element);
}
}
Returns
Type Description

listServerTlsPolicies(ListServerTlsPoliciesRequest request)

publicfinalNetworkSecurityClient.ListServerTlsPoliciesPagedResponselistServerTlsPolicies(ListServerTlsPoliciesRequestrequest)

Lists ServerTlsPolicies in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
ListServerTlsPoliciesRequestrequest=
ListServerTlsPoliciesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for(ServerTlsPolicyelement:
networkSecurityClient.listServerTlsPolicies(request).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
request ListServerTlsPoliciesRequest

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

Returns
Type Description

listServerTlsPolicies(LocationName parent)

publicfinalNetworkSecurityClient.ListServerTlsPoliciesPagedResponselistServerTlsPolicies(LocationNameparent)

Lists ServerTlsPolicies in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
LocationNameparent=LocationName.of("[PROJECT]","[LOCATION]");
for(ServerTlsPolicyelement:
networkSecurityClient.listServerTlsPolicies(parent).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
parent LocationName

Required. The project and location from which the ServerTlsPolicies should be listed, specified in the format projects/*/locations/{location}.

Returns
Type Description

listServerTlsPolicies(String parent)

publicfinalNetworkSecurityClient.ListServerTlsPoliciesPagedResponselistServerTlsPolicies(Stringparent)

Lists ServerTlsPolicies in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
Stringparent=LocationName.of("[PROJECT]","[LOCATION]").toString();
for(ServerTlsPolicyelement:
networkSecurityClient.listServerTlsPolicies(parent).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
parent String

Required. The project and location from which the ServerTlsPolicies should be listed, specified in the format projects/*/locations/{location}.

Returns
Type Description

listServerTlsPoliciesCallable()

publicfinalUnaryCallable<ListServerTlsPoliciesRequest,ListServerTlsPoliciesResponse>listServerTlsPoliciesCallable()

Lists ServerTlsPolicies in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
ListServerTlsPoliciesRequestrequest=
ListServerTlsPoliciesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while(true){
ListServerTlsPoliciesResponseresponse=
networkSecurityClient.listServerTlsPoliciesCallable().call(request);
for(ServerTlsPolicyelement:response.getServerTlsPoliciesList()){
// doThingsWith(element);
}
StringnextPageToken=response.getNextPageToken();
if(!Strings.isNullOrEmpty(nextPageToken)){
request=request.toBuilder().setPageToken(nextPageToken).build();
}else{
break;
}
}
}
Returns
Type Description

listServerTlsPoliciesPagedCallable()

publicfinalUnaryCallable<ListServerTlsPoliciesRequest,NetworkSecurityClient.ListServerTlsPoliciesPagedResponse>listServerTlsPoliciesPagedCallable()

Lists ServerTlsPolicies in a given project and location.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
ListServerTlsPoliciesRequestrequest=
ListServerTlsPoliciesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<ServerTlsPolicy>future=
networkSecurityClient.listServerTlsPoliciesPagedCallable().futureCall(request);
// Do something.
for(ServerTlsPolicyelement:future.get().iterateAll()){
// doThingsWith(element);
}
}
Returns
Type Description

shutdown()

publicvoidshutdown()

shutdownNow()

publicvoidshutdownNow()

updateAuthorizationPolicyAsync(AuthorizationPolicy authorizationPolicy, FieldMask updateMask)

publicfinalOperationFuture<AuthorizationPolicy,OperationMetadata>updateAuthorizationPolicyAsync(AuthorizationPolicyauthorizationPolicy,FieldMaskupdateMask)

Updates the parameters of a single AuthorizationPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
AuthorizationPolicyauthorizationPolicy=AuthorizationPolicy.newBuilder().build();
FieldMaskupdateMask=FieldMask.newBuilder().build();
AuthorizationPolicyresponse=
networkSecurityClient
.updateAuthorizationPolicyAsync(authorizationPolicy,updateMask)
.get();
}
Parameters
Name Description
authorizationPolicy AuthorizationPolicy

Required. Updated AuthorizationPolicy resource.

updateMask FieldMask

Optional. Field mask is used to specify the fields to be overwritten in the AuthorizationPolicy resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.

Returns
Type Description

updateAuthorizationPolicyAsync(UpdateAuthorizationPolicyRequest request)

publicfinalOperationFuture<AuthorizationPolicy,OperationMetadata>updateAuthorizationPolicyAsync(UpdateAuthorizationPolicyRequestrequest)

Updates the parameters of a single AuthorizationPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
UpdateAuthorizationPolicyRequestrequest=
UpdateAuthorizationPolicyRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setAuthorizationPolicy(AuthorizationPolicy.newBuilder().build())
.build();
AuthorizationPolicyresponse=
networkSecurityClient.updateAuthorizationPolicyAsync(request).get();
}
Parameter
Name Description
request UpdateAuthorizationPolicyRequest

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

Returns
Type Description

updateAuthorizationPolicyCallable()

publicfinalUnaryCallable<UpdateAuthorizationPolicyRequest,Operation>updateAuthorizationPolicyCallable()

Updates the parameters of a single AuthorizationPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
UpdateAuthorizationPolicyRequestrequest=
UpdateAuthorizationPolicyRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setAuthorizationPolicy(AuthorizationPolicy.newBuilder().build())
.build();
ApiFuture<Operation>future=
networkSecurityClient.updateAuthorizationPolicyCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
Returns
Type Description

updateAuthorizationPolicyOperationCallable()

publicfinalOperationCallable<UpdateAuthorizationPolicyRequest,AuthorizationPolicy,OperationMetadata>updateAuthorizationPolicyOperationCallable()

Updates the parameters of a single AuthorizationPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
UpdateAuthorizationPolicyRequestrequest=
UpdateAuthorizationPolicyRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setAuthorizationPolicy(AuthorizationPolicy.newBuilder().build())
.build();
OperationFuture<AuthorizationPolicy,OperationMetadata>future=
networkSecurityClient.updateAuthorizationPolicyOperationCallable().futureCall(request);
// Do something.
AuthorizationPolicyresponse=future.get();
}
Returns
Type Description

updateClientTlsPolicyAsync(ClientTlsPolicy clientTlsPolicy, FieldMask updateMask)

publicfinalOperationFuture<ClientTlsPolicy,OperationMetadata>updateClientTlsPolicyAsync(ClientTlsPolicyclientTlsPolicy,FieldMaskupdateMask)

Updates the parameters of a single ClientTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
ClientTlsPolicyclientTlsPolicy=ClientTlsPolicy.newBuilder().build();
FieldMaskupdateMask=FieldMask.newBuilder().build();
ClientTlsPolicyresponse=
networkSecurityClient.updateClientTlsPolicyAsync(clientTlsPolicy,updateMask).get();
}
Parameters
Name Description
clientTlsPolicy ClientTlsPolicy

Required. Updated ClientTlsPolicy resource.

updateMask FieldMask

Optional. Field mask is used to specify the fields to be overwritten in the ClientTlsPolicy resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.

Returns
Type Description

updateClientTlsPolicyAsync(UpdateClientTlsPolicyRequest request)

publicfinalOperationFuture<ClientTlsPolicy,OperationMetadata>updateClientTlsPolicyAsync(UpdateClientTlsPolicyRequestrequest)

Updates the parameters of a single ClientTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
UpdateClientTlsPolicyRequestrequest=
UpdateClientTlsPolicyRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setClientTlsPolicy(ClientTlsPolicy.newBuilder().build())
.build();
ClientTlsPolicyresponse=networkSecurityClient.updateClientTlsPolicyAsync(request).get();
}
Parameter
Name Description
request UpdateClientTlsPolicyRequest

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

Returns
Type Description

updateClientTlsPolicyCallable()

publicfinalUnaryCallable<UpdateClientTlsPolicyRequest,Operation>updateClientTlsPolicyCallable()

Updates the parameters of a single ClientTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
UpdateClientTlsPolicyRequestrequest=
UpdateClientTlsPolicyRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setClientTlsPolicy(ClientTlsPolicy.newBuilder().build())
.build();
ApiFuture<Operation>future=
networkSecurityClient.updateClientTlsPolicyCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
Returns
Type Description

updateClientTlsPolicyOperationCallable()

publicfinalOperationCallable<UpdateClientTlsPolicyRequest,ClientTlsPolicy,OperationMetadata>updateClientTlsPolicyOperationCallable()

Updates the parameters of a single ClientTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
UpdateClientTlsPolicyRequestrequest=
UpdateClientTlsPolicyRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setClientTlsPolicy(ClientTlsPolicy.newBuilder().build())
.build();
OperationFuture<ClientTlsPolicy,OperationMetadata>future=
networkSecurityClient.updateClientTlsPolicyOperationCallable().futureCall(request);
// Do something.
ClientTlsPolicyresponse=future.get();
}
Returns
Type Description

updateServerTlsPolicyAsync(ServerTlsPolicy serverTlsPolicy, FieldMask updateMask)

publicfinalOperationFuture<ServerTlsPolicy,OperationMetadata>updateServerTlsPolicyAsync(ServerTlsPolicyserverTlsPolicy,FieldMaskupdateMask)

Updates the parameters of a single ServerTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
ServerTlsPolicyserverTlsPolicy=ServerTlsPolicy.newBuilder().build();
FieldMaskupdateMask=FieldMask.newBuilder().build();
ServerTlsPolicyresponse=
networkSecurityClient.updateServerTlsPolicyAsync(serverTlsPolicy,updateMask).get();
}
Parameters
Name Description
serverTlsPolicy ServerTlsPolicy

Required. Updated ServerTlsPolicy resource.

updateMask FieldMask

Optional. Field mask is used to specify the fields to be overwritten in the ServerTlsPolicy resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.

Returns
Type Description

updateServerTlsPolicyAsync(UpdateServerTlsPolicyRequest request)

publicfinalOperationFuture<ServerTlsPolicy,OperationMetadata>updateServerTlsPolicyAsync(UpdateServerTlsPolicyRequestrequest)

Updates the parameters of a single ServerTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
UpdateServerTlsPolicyRequestrequest=
UpdateServerTlsPolicyRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setServerTlsPolicy(ServerTlsPolicy.newBuilder().build())
.build();
ServerTlsPolicyresponse=networkSecurityClient.updateServerTlsPolicyAsync(request).get();
}
Parameter
Name Description
request UpdateServerTlsPolicyRequest

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

Returns
Type Description

updateServerTlsPolicyCallable()

publicfinalUnaryCallable<UpdateServerTlsPolicyRequest,Operation>updateServerTlsPolicyCallable()

Updates the parameters of a single ServerTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
UpdateServerTlsPolicyRequestrequest=
UpdateServerTlsPolicyRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setServerTlsPolicy(ServerTlsPolicy.newBuilder().build())
.build();
ApiFuture<Operation>future=
networkSecurityClient.updateServerTlsPolicyCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
Returns
Type Description

updateServerTlsPolicyOperationCallable()

publicfinalOperationCallable<UpdateServerTlsPolicyRequest,ServerTlsPolicy,OperationMetadata>updateServerTlsPolicyOperationCallable()

Updates the parameters of a single ServerTlsPolicy.

Sample code:


// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(NetworkSecurityClientnetworkSecurityClient=NetworkSecurityClient.create()){
UpdateServerTlsPolicyRequestrequest=
UpdateServerTlsPolicyRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setServerTlsPolicy(ServerTlsPolicy.newBuilder().build())
.build();
OperationFuture<ServerTlsPolicy,OperationMetadata>future=
networkSecurityClient.updateServerTlsPolicyOperationCallable().futureCall(request);
// Do something.
ServerTlsPolicyresponse=future.get();
}
Returns
Type Description

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月30日 UTC.