@Generated(value="by gapic-generator") @BetaApi public class InstanceTemplateClient extends Object implements BackgroundResource
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:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
ProjectGlobalInstanceTemplateName instanceTemplate = ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]");
Operation response = instanceTemplateClient.deleteInstanceTemplate(instanceTemplate);
}
Note: close() needs to be called on the instanceTemplateClient 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:
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 InstanceTemplateSettings to create(). For example:
To customize credentials:
InstanceTemplateSettings instanceTemplateSettings =
InstanceTemplateSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
InstanceTemplateClient instanceTemplateClient =
InstanceTemplateClient.create(instanceTemplateSettings);
To customize the endpoint:
InstanceTemplateSettings instanceTemplateSettings =
InstanceTemplateSettings.newBuilder().setEndpoint(myEndpoint).build();
InstanceTemplateClient instanceTemplateClient =
InstanceTemplateClient.create(instanceTemplateSettings);
Modifier and Type | Class and Description |
---|---|
static class |
InstanceTemplateClient.ListInstanceTemplatesFixedSizeCollection |
static class |
InstanceTemplateClient.ListInstanceTemplatesPage |
static class |
InstanceTemplateClient.ListInstanceTemplatesPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
InstanceTemplateClient(InstanceTemplateSettings settings)
Constructs an instance of InstanceTemplateClient, using the given settings.
|
protected |
InstanceTemplateClient(InstanceTemplateStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static InstanceTemplateClient |
create()
Constructs an instance of InstanceTemplateClient with default settings.
|
static InstanceTemplateClient |
create(InstanceTemplateSettings settings)
Constructs an instance of InstanceTemplateClient, using the given settings.
|
static InstanceTemplateClient |
create(InstanceTemplateStub stub)
Constructs an instance of InstanceTemplateClient, using the given stub for making calls.
|
Operation |
deleteInstanceTemplate(DeleteInstanceTemplateHttpRequest request)
Deletes the specified instance template.
|
Operation |
deleteInstanceTemplate(ProjectGlobalInstanceTemplateName instanceTemplate)
Deletes the specified instance template.
|
Operation |
deleteInstanceTemplate(String instanceTemplate)
Deletes the specified instance template.
|
UnaryCallable<DeleteInstanceTemplateHttpRequest,Operation> |
deleteInstanceTemplateCallable()
Deletes the specified instance template.
|
Policy |
getIamPolicyInstanceTemplate(GetIamPolicyInstanceTemplateHttpRequest request)
Gets the access control policy for a resource.
|
Policy |
getIamPolicyInstanceTemplate(ProjectGlobalInstanceTemplateResourceName resource)
Gets the access control policy for a resource.
|
Policy |
getIamPolicyInstanceTemplate(String resource)
Gets the access control policy for a resource.
|
UnaryCallable<GetIamPolicyInstanceTemplateHttpRequest,Policy> |
getIamPolicyInstanceTemplateCallable()
Gets the access control policy for a resource.
|
InstanceTemplate |
getInstanceTemplate(GetInstanceTemplateHttpRequest request)
Returns the specified instance template.
|
InstanceTemplate |
getInstanceTemplate(ProjectGlobalInstanceTemplateName instanceTemplate)
Returns the specified instance template.
|
InstanceTemplate |
getInstanceTemplate(String instanceTemplate)
Returns the specified instance template.
|
UnaryCallable<GetInstanceTemplateHttpRequest,InstanceTemplate> |
getInstanceTemplateCallable()
Returns the specified instance template.
|
InstanceTemplateSettings |
getSettings() |
InstanceTemplateStub |
getStub() |
Operation |
insertInstanceTemplate(InsertInstanceTemplateHttpRequest request)
Creates an instance template in the specified project using the data that is included in the
request.
|
Operation |
insertInstanceTemplate(ProjectName project,
InstanceTemplate instanceTemplateResource)
Creates an instance template in the specified project using the data that is included in the
request.
|
Operation |
insertInstanceTemplate(String project,
InstanceTemplate instanceTemplateResource)
Creates an instance template in the specified project using the data that is included in the
request.
|
UnaryCallable<InsertInstanceTemplateHttpRequest,Operation> |
insertInstanceTemplateCallable()
Creates an instance template in the specified project using the data that is included in the
request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
InstanceTemplateClient.ListInstanceTemplatesPagedResponse |
listInstanceTemplates(ListInstanceTemplatesHttpRequest request)
Retrieves a list of instance templates that are contained within the specified project.
|
InstanceTemplateClient.ListInstanceTemplatesPagedResponse |
listInstanceTemplates(ProjectName project)
Retrieves a list of instance templates that are contained within the specified project.
|
InstanceTemplateClient.ListInstanceTemplatesPagedResponse |
listInstanceTemplates(String project)
Retrieves a list of instance templates that are contained within the specified project.
|
UnaryCallable<ListInstanceTemplatesHttpRequest,InstanceTemplateList> |
listInstanceTemplatesCallable()
Retrieves a list of instance templates that are contained within the specified project.
|
UnaryCallable<ListInstanceTemplatesHttpRequest,InstanceTemplateClient.ListInstanceTemplatesPagedResponse> |
listInstanceTemplatesPagedCallable()
Retrieves a list of instance templates that are contained within the specified project.
|
Policy |
setIamPolicyInstanceTemplate(ProjectGlobalInstanceTemplateResourceName resource,
GlobalSetPolicyRequest globalSetPolicyRequestResource)
Sets the access control policy on the specified resource.
|
Policy |
setIamPolicyInstanceTemplate(SetIamPolicyInstanceTemplateHttpRequest request)
Sets the access control policy on the specified resource.
|
Policy |
setIamPolicyInstanceTemplate(String resource,
GlobalSetPolicyRequest globalSetPolicyRequestResource)
Sets the access control policy on the specified resource.
|
UnaryCallable<SetIamPolicyInstanceTemplateHttpRequest,Policy> |
setIamPolicyInstanceTemplateCallable()
Sets the access control policy on the specified resource.
|
void |
shutdown() |
void |
shutdownNow() |
TestPermissionsResponse |
testIamPermissionsInstanceTemplate(ProjectGlobalInstanceTemplateResourceName resource,
TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
|
TestPermissionsResponse |
testIamPermissionsInstanceTemplate(String resource,
TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
|
TestPermissionsResponse |
testIamPermissionsInstanceTemplate(TestIamPermissionsInstanceTemplateHttpRequest request)
Returns permissions that a caller has on the specified resource.
|
UnaryCallable<TestIamPermissionsInstanceTemplateHttpRequest,TestPermissionsResponse> |
testIamPermissionsInstanceTemplateCallable()
Returns permissions that a caller has on the specified resource.
|
protected InstanceTemplateClient(InstanceTemplateSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected InstanceTemplateClient(InstanceTemplateStub stub)
public static final InstanceTemplateClient create() throws IOException
IOException
public static final InstanceTemplateClient create(InstanceTemplateSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final InstanceTemplateClient create(InstanceTemplateStub stub)
public final InstanceTemplateSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public InstanceTemplateStub getStub()
@BetaApi public final Operation deleteInstanceTemplate(ProjectGlobalInstanceTemplateName instanceTemplate)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
ProjectGlobalInstanceTemplateName instanceTemplate = ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]");
Operation response = instanceTemplateClient.deleteInstanceTemplate(instanceTemplate);
}
instanceTemplate
- The name of the instance template to delete.ApiException
- if the remote call fails@BetaApi public final Operation deleteInstanceTemplate(String instanceTemplate)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
ProjectGlobalInstanceTemplateName instanceTemplate = ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]");
Operation response = instanceTemplateClient.deleteInstanceTemplate(instanceTemplate.toString());
}
instanceTemplate
- The name of the instance template to delete.ApiException
- if the remote call fails@BetaApi public final Operation deleteInstanceTemplate(DeleteInstanceTemplateHttpRequest request)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
String formattedInstanceTemplate = ProjectGlobalInstanceTemplateName.format("[PROJECT]", "[INSTANCE_TEMPLATE]");
DeleteInstanceTemplateHttpRequest request = DeleteInstanceTemplateHttpRequest.newBuilder()
.setInstanceTemplate(formattedInstanceTemplate)
.build();
Operation response = instanceTemplateClient.deleteInstanceTemplate(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<DeleteInstanceTemplateHttpRequest,Operation> deleteInstanceTemplateCallable()
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
String formattedInstanceTemplate = ProjectGlobalInstanceTemplateName.format("[PROJECT]", "[INSTANCE_TEMPLATE]");
DeleteInstanceTemplateHttpRequest request = DeleteInstanceTemplateHttpRequest.newBuilder()
.setInstanceTemplate(formattedInstanceTemplate)
.build();
ApiFuture<Operation> future = instanceTemplateClient.deleteInstanceTemplateCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final InstanceTemplate getInstanceTemplate(ProjectGlobalInstanceTemplateName instanceTemplate)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
ProjectGlobalInstanceTemplateName instanceTemplate = ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]");
InstanceTemplate response = instanceTemplateClient.getInstanceTemplate(instanceTemplate);
}
instanceTemplate
- The name of the instance template.ApiException
- if the remote call fails@BetaApi public final InstanceTemplate getInstanceTemplate(String instanceTemplate)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
ProjectGlobalInstanceTemplateName instanceTemplate = ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]");
InstanceTemplate response = instanceTemplateClient.getInstanceTemplate(instanceTemplate.toString());
}
instanceTemplate
- The name of the instance template.ApiException
- if the remote call fails@BetaApi public final InstanceTemplate getInstanceTemplate(GetInstanceTemplateHttpRequest request)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
String formattedInstanceTemplate = ProjectGlobalInstanceTemplateName.format("[PROJECT]", "[INSTANCE_TEMPLATE]");
GetInstanceTemplateHttpRequest request = GetInstanceTemplateHttpRequest.newBuilder()
.setInstanceTemplate(formattedInstanceTemplate)
.build();
InstanceTemplate response = instanceTemplateClient.getInstanceTemplate(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<GetInstanceTemplateHttpRequest,InstanceTemplate> getInstanceTemplateCallable()
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
String formattedInstanceTemplate = ProjectGlobalInstanceTemplateName.format("[PROJECT]", "[INSTANCE_TEMPLATE]");
GetInstanceTemplateHttpRequest request = GetInstanceTemplateHttpRequest.newBuilder()
.setInstanceTemplate(formattedInstanceTemplate)
.build();
ApiFuture<InstanceTemplate> future = instanceTemplateClient.getInstanceTemplateCallable().futureCall(request);
// Do something
InstanceTemplate response = future.get();
}
@BetaApi public final Policy getIamPolicyInstanceTemplate(ProjectGlobalInstanceTemplateResourceName resource)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
ProjectGlobalInstanceTemplateResourceName resource = ProjectGlobalInstanceTemplateResourceName.of("[PROJECT]", "[RESOURCE]");
Policy response = instanceTemplateClient.getIamPolicyInstanceTemplate(resource);
}
resource
- Name or id of the resource for this request.ApiException
- if the remote call fails@BetaApi public final Policy getIamPolicyInstanceTemplate(String resource)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
ProjectGlobalInstanceTemplateResourceName resource = ProjectGlobalInstanceTemplateResourceName.of("[PROJECT]", "[RESOURCE]");
Policy response = instanceTemplateClient.getIamPolicyInstanceTemplate(resource.toString());
}
resource
- Name or id of the resource for this request.ApiException
- if the remote call fails@BetaApi public final Policy getIamPolicyInstanceTemplate(GetIamPolicyInstanceTemplateHttpRequest request)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
String formattedResource = ProjectGlobalInstanceTemplateResourceName.format("[PROJECT]", "[RESOURCE]");
GetIamPolicyInstanceTemplateHttpRequest request = GetIamPolicyInstanceTemplateHttpRequest.newBuilder()
.setResource(formattedResource)
.build();
Policy response = instanceTemplateClient.getIamPolicyInstanceTemplate(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<GetIamPolicyInstanceTemplateHttpRequest,Policy> getIamPolicyInstanceTemplateCallable()
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
String formattedResource = ProjectGlobalInstanceTemplateResourceName.format("[PROJECT]", "[RESOURCE]");
GetIamPolicyInstanceTemplateHttpRequest request = GetIamPolicyInstanceTemplateHttpRequest.newBuilder()
.setResource(formattedResource)
.build();
ApiFuture<Policy> future = instanceTemplateClient.getIamPolicyInstanceTemplateCallable().futureCall(request);
// Do something
Policy response = future.get();
}
@BetaApi public final Operation insertInstanceTemplate(ProjectName project, InstanceTemplate instanceTemplateResource)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
InstanceTemplate instanceTemplateResource = InstanceTemplate.newBuilder().build();
Operation response = instanceTemplateClient.insertInstanceTemplate(project, instanceTemplateResource);
}
project
- Project ID for this request.instanceTemplateResource
- An Instance Template resource. (== resource_for
beta.instanceTemplates ==) (== resource_for v1.instanceTemplates ==)ApiException
- if the remote call fails@BetaApi public final Operation insertInstanceTemplate(String project, InstanceTemplate instanceTemplateResource)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
InstanceTemplate instanceTemplateResource = InstanceTemplate.newBuilder().build();
Operation response = instanceTemplateClient.insertInstanceTemplate(project.toString(), instanceTemplateResource);
}
project
- Project ID for this request.instanceTemplateResource
- An Instance Template resource. (== resource_for
beta.instanceTemplates ==) (== resource_for v1.instanceTemplates ==)ApiException
- if the remote call fails@BetaApi public final Operation insertInstanceTemplate(InsertInstanceTemplateHttpRequest request)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
InstanceTemplate instanceTemplateResource = InstanceTemplate.newBuilder().build();
InsertInstanceTemplateHttpRequest request = InsertInstanceTemplateHttpRequest.newBuilder()
.setProject(formattedProject)
.setInstanceTemplateResource(instanceTemplateResource)
.build();
Operation response = instanceTemplateClient.insertInstanceTemplate(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<InsertInstanceTemplateHttpRequest,Operation> insertInstanceTemplateCallable()
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
InstanceTemplate instanceTemplateResource = InstanceTemplate.newBuilder().build();
InsertInstanceTemplateHttpRequest request = InsertInstanceTemplateHttpRequest.newBuilder()
.setProject(formattedProject)
.setInstanceTemplateResource(instanceTemplateResource)
.build();
ApiFuture<Operation> future = instanceTemplateClient.insertInstanceTemplateCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final InstanceTemplateClient.ListInstanceTemplatesPagedResponse listInstanceTemplates(ProjectName project)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (InstanceTemplate element : instanceTemplateClient.listInstanceTemplates(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final InstanceTemplateClient.ListInstanceTemplatesPagedResponse listInstanceTemplates(String project)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (InstanceTemplate element : instanceTemplateClient.listInstanceTemplates(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final InstanceTemplateClient.ListInstanceTemplatesPagedResponse listInstanceTemplates(ListInstanceTemplatesHttpRequest request)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListInstanceTemplatesHttpRequest request = ListInstanceTemplatesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (InstanceTemplate element : instanceTemplateClient.listInstanceTemplates(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<ListInstanceTemplatesHttpRequest,InstanceTemplateClient.ListInstanceTemplatesPagedResponse> listInstanceTemplatesPagedCallable()
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListInstanceTemplatesHttpRequest request = ListInstanceTemplatesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<ListInstanceTemplatesPagedResponse> future = instanceTemplateClient.listInstanceTemplatesPagedCallable().futureCall(request);
// Do something
for (InstanceTemplate element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final UnaryCallable<ListInstanceTemplatesHttpRequest,InstanceTemplateList> listInstanceTemplatesCallable()
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListInstanceTemplatesHttpRequest request = ListInstanceTemplatesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
InstanceTemplateList response = instanceTemplateClient.listInstanceTemplatesCallable().call(request);
for (InstanceTemplate element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Policy setIamPolicyInstanceTemplate(ProjectGlobalInstanceTemplateResourceName resource, GlobalSetPolicyRequest globalSetPolicyRequestResource)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
ProjectGlobalInstanceTemplateResourceName resource = ProjectGlobalInstanceTemplateResourceName.of("[PROJECT]", "[RESOURCE]");
GlobalSetPolicyRequest globalSetPolicyRequestResource = GlobalSetPolicyRequest.newBuilder().build();
Policy response = instanceTemplateClient.setIamPolicyInstanceTemplate(resource, globalSetPolicyRequestResource);
}
resource
- Name or id of the resource for this request.globalSetPolicyRequestResource
- ApiException
- if the remote call fails@BetaApi public final Policy setIamPolicyInstanceTemplate(String resource, GlobalSetPolicyRequest globalSetPolicyRequestResource)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
ProjectGlobalInstanceTemplateResourceName resource = ProjectGlobalInstanceTemplateResourceName.of("[PROJECT]", "[RESOURCE]");
GlobalSetPolicyRequest globalSetPolicyRequestResource = GlobalSetPolicyRequest.newBuilder().build();
Policy response = instanceTemplateClient.setIamPolicyInstanceTemplate(resource.toString(), globalSetPolicyRequestResource);
}
resource
- Name or id of the resource for this request.globalSetPolicyRequestResource
- ApiException
- if the remote call fails@BetaApi public final Policy setIamPolicyInstanceTemplate(SetIamPolicyInstanceTemplateHttpRequest request)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
String formattedResource = ProjectGlobalInstanceTemplateResourceName.format("[PROJECT]", "[RESOURCE]");
GlobalSetPolicyRequest globalSetPolicyRequestResource = GlobalSetPolicyRequest.newBuilder().build();
SetIamPolicyInstanceTemplateHttpRequest request = SetIamPolicyInstanceTemplateHttpRequest.newBuilder()
.setResource(formattedResource)
.setGlobalSetPolicyRequestResource(globalSetPolicyRequestResource)
.build();
Policy response = instanceTemplateClient.setIamPolicyInstanceTemplate(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<SetIamPolicyInstanceTemplateHttpRequest,Policy> setIamPolicyInstanceTemplateCallable()
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
String formattedResource = ProjectGlobalInstanceTemplateResourceName.format("[PROJECT]", "[RESOURCE]");
GlobalSetPolicyRequest globalSetPolicyRequestResource = GlobalSetPolicyRequest.newBuilder().build();
SetIamPolicyInstanceTemplateHttpRequest request = SetIamPolicyInstanceTemplateHttpRequest.newBuilder()
.setResource(formattedResource)
.setGlobalSetPolicyRequestResource(globalSetPolicyRequestResource)
.build();
ApiFuture<Policy> future = instanceTemplateClient.setIamPolicyInstanceTemplateCallable().futureCall(request);
// Do something
Policy response = future.get();
}
@BetaApi public final TestPermissionsResponse testIamPermissionsInstanceTemplate(ProjectGlobalInstanceTemplateResourceName resource, TestPermissionsRequest testPermissionsRequestResource)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
ProjectGlobalInstanceTemplateResourceName resource = ProjectGlobalInstanceTemplateResourceName.of("[PROJECT]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response = instanceTemplateClient.testIamPermissionsInstanceTemplate(resource, testPermissionsRequestResource);
}
resource
- Name or id of the resource for this request.testPermissionsRequestResource
- ApiException
- if the remote call fails@BetaApi public final TestPermissionsResponse testIamPermissionsInstanceTemplate(String resource, TestPermissionsRequest testPermissionsRequestResource)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
ProjectGlobalInstanceTemplateResourceName resource = ProjectGlobalInstanceTemplateResourceName.of("[PROJECT]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response = instanceTemplateClient.testIamPermissionsInstanceTemplate(resource.toString(), testPermissionsRequestResource);
}
resource
- Name or id of the resource for this request.testPermissionsRequestResource
- ApiException
- if the remote call fails@BetaApi public final TestPermissionsResponse testIamPermissionsInstanceTemplate(TestIamPermissionsInstanceTemplateHttpRequest request)
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
String formattedResource = ProjectGlobalInstanceTemplateResourceName.format("[PROJECT]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestIamPermissionsInstanceTemplateHttpRequest request = TestIamPermissionsInstanceTemplateHttpRequest.newBuilder()
.setResource(formattedResource)
.setTestPermissionsRequestResource(testPermissionsRequestResource)
.build();
TestPermissionsResponse response = instanceTemplateClient.testIamPermissionsInstanceTemplate(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<TestIamPermissionsInstanceTemplateHttpRequest,TestPermissionsResponse> testIamPermissionsInstanceTemplateCallable()
Sample code:
try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
String formattedResource = ProjectGlobalInstanceTemplateResourceName.format("[PROJECT]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestIamPermissionsInstanceTemplateHttpRequest request = TestIamPermissionsInstanceTemplateHttpRequest.newBuilder()
.setResource(formattedResource)
.setTestPermissionsRequestResource(testPermissionsRequestResource)
.build();
ApiFuture<TestPermissionsResponse> future = instanceTemplateClient.testIamPermissionsInstanceTemplateCallable().futureCall(request);
// Do something
TestPermissionsResponse response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.