@Generated(value="by gapic-generator") @BetaApi public class ImageClient extends Object implements com.google.api.gax.core.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 (ImageClient imageClient = ImageClient.create()) {
ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
Operation response = imageClient.deleteImage(image);
}
Note: close() needs to be called on the imageClient 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 ImageSettings to create(). For example:
To customize credentials:
ImageSettings imageSettings =
ImageSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ImageClient imageClient =
ImageClient.create(imageSettings);
To customize the endpoint:
ImageSettings imageSettings =
ImageSettings.newBuilder().setEndpoint(myEndpoint).build();
ImageClient imageClient =
ImageClient.create(imageSettings);
Modifier and Type | Class and Description |
---|---|
static class |
ImageClient.ListImagesFixedSizeCollection |
static class |
ImageClient.ListImagesPage |
static class |
ImageClient.ListImagesPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
ImageClient(ImageSettings settings)
Constructs an instance of ImageClient, using the given settings.
|
protected |
ImageClient(ImageStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static ImageClient |
create()
Constructs an instance of ImageClient with default settings.
|
static ImageClient |
create(ImageSettings settings)
Constructs an instance of ImageClient, using the given settings.
|
static ImageClient |
create(ImageStub stub)
Constructs an instance of ImageClient, using the given stub for making calls.
|
Operation |
deleteImage(DeleteImageHttpRequest request)
Deletes the specified image.
|
Operation |
deleteImage(ProjectGlobalImageName image)
Deletes the specified image.
|
Operation |
deleteImage(String image)
Deletes the specified image.
|
com.google.api.gax.rpc.UnaryCallable<DeleteImageHttpRequest,Operation> |
deleteImageCallable()
Deletes the specified image.
|
Operation |
deprecateImage(DeprecateImageHttpRequest request)
Sets the deprecation status of an image.
|
Operation |
deprecateImage(ProjectGlobalImageName image,
DeprecationStatus deprecationStatusResource)
Sets the deprecation status of an image.
|
Operation |
deprecateImage(String image,
DeprecationStatus deprecationStatusResource)
Sets the deprecation status of an image.
|
com.google.api.gax.rpc.UnaryCallable<DeprecateImageHttpRequest,Operation> |
deprecateImageCallable()
Sets the deprecation status of an image.
|
Image |
getFromFamilyImage(GetFromFamilyImageHttpRequest request)
Returns the latest image that is part of an image family and is not deprecated.
|
Image |
getFromFamilyImage(ProjectGlobalImageFamilyName family)
Returns the latest image that is part of an image family and is not deprecated.
|
Image |
getFromFamilyImage(String family)
Returns the latest image that is part of an image family and is not deprecated.
|
com.google.api.gax.rpc.UnaryCallable<GetFromFamilyImageHttpRequest,Image> |
getFromFamilyImageCallable()
Returns the latest image that is part of an image family and is not deprecated.
|
Policy |
getIamPolicyImage(GetIamPolicyImageHttpRequest request)
Gets the access control policy for a resource.
|
Policy |
getIamPolicyImage(ProjectGlobalImageResourceName resource)
Gets the access control policy for a resource.
|
Policy |
getIamPolicyImage(String resource)
Gets the access control policy for a resource.
|
com.google.api.gax.rpc.UnaryCallable<GetIamPolicyImageHttpRequest,Policy> |
getIamPolicyImageCallable()
Gets the access control policy for a resource.
|
Image |
getImage(GetImageHttpRequest request)
Returns the specified image.
|
Image |
getImage(ProjectGlobalImageName image)
Returns the specified image.
|
Image |
getImage(String image)
Returns the specified image.
|
com.google.api.gax.rpc.UnaryCallable<GetImageHttpRequest,Image> |
getImageCallable()
Returns the specified image.
|
ImageSettings |
getSettings() |
ImageStub |
getStub() |
Operation |
insertImage(Boolean forceCreate,
ProjectName project,
Image imageResource)
Creates an image in the specified project using the data included in the request.
|
Operation |
insertImage(Boolean forceCreate,
String project,
Image imageResource)
Creates an image in the specified project using the data included in the request.
|
Operation |
insertImage(InsertImageHttpRequest request)
Creates an image in the specified project using the data included in the request.
|
com.google.api.gax.rpc.UnaryCallable<InsertImageHttpRequest,Operation> |
insertImageCallable()
Creates an image in the specified project using the data included in the request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
ImageClient.ListImagesPagedResponse |
listImages(ListImagesHttpRequest request)
Retrieves the list of custom images available to the specified project.
|
ImageClient.ListImagesPagedResponse |
listImages(ProjectName project)
Retrieves the list of custom images available to the specified project.
|
ImageClient.ListImagesPagedResponse |
listImages(String project)
Retrieves the list of custom images available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListImagesHttpRequest,ImageList> |
listImagesCallable()
Retrieves the list of custom images available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListImagesHttpRequest,ImageClient.ListImagesPagedResponse> |
listImagesPagedCallable()
Retrieves the list of custom images available to the specified project.
|
Policy |
setIamPolicyImage(ProjectGlobalImageResourceName resource,
GlobalSetPolicyRequest globalSetPolicyRequestResource)
Sets the access control policy on the specified resource.
|
Policy |
setIamPolicyImage(SetIamPolicyImageHttpRequest request)
Sets the access control policy on the specified resource.
|
Policy |
setIamPolicyImage(String resource,
GlobalSetPolicyRequest globalSetPolicyRequestResource)
Sets the access control policy on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<SetIamPolicyImageHttpRequest,Policy> |
setIamPolicyImageCallable()
Sets the access control policy on the specified resource.
|
Operation |
setLabelsImage(ProjectGlobalImageResourceName resource,
GlobalSetLabelsRequest globalSetLabelsRequestResource)
Sets the labels on an image.
|
Operation |
setLabelsImage(SetLabelsImageHttpRequest request)
Sets the labels on an image.
|
Operation |
setLabelsImage(String resource,
GlobalSetLabelsRequest globalSetLabelsRequestResource)
Sets the labels on an image.
|
com.google.api.gax.rpc.UnaryCallable<SetLabelsImageHttpRequest,Operation> |
setLabelsImageCallable()
Sets the labels on an image.
|
void |
shutdown() |
void |
shutdownNow() |
TestPermissionsResponse |
testIamPermissionsImage(ProjectGlobalImageResourceName resource,
TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
|
TestPermissionsResponse |
testIamPermissionsImage(String resource,
TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
|
TestPermissionsResponse |
testIamPermissionsImage(TestIamPermissionsImageHttpRequest request)
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<TestIamPermissionsImageHttpRequest,TestPermissionsResponse> |
testIamPermissionsImageCallable()
Returns permissions that a caller has on the specified resource.
|
protected ImageClient(ImageSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected ImageClient(ImageStub stub)
public static final ImageClient create() throws IOException
IOException
public static final ImageClient create(ImageSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final ImageClient create(ImageStub stub)
public final ImageSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public ImageStub getStub()
@BetaApi public final Operation deleteImage(ProjectGlobalImageName image)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
Operation response = imageClient.deleteImage(image);
}
image
- Name of the image resource to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteImage(String image)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
Operation response = imageClient.deleteImage(image.toString());
}
image
- Name of the image resource to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteImage(DeleteImageHttpRequest request)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
String formattedImage = ProjectGlobalImageName.format("[PROJECT]", "[IMAGE]");
DeleteImageHttpRequest request = DeleteImageHttpRequest.newBuilder()
.setImage(formattedImage)
.build();
Operation response = imageClient.deleteImage(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<DeleteImageHttpRequest,Operation> deleteImageCallable()
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
String formattedImage = ProjectGlobalImageName.format("[PROJECT]", "[IMAGE]");
DeleteImageHttpRequest request = DeleteImageHttpRequest.newBuilder()
.setImage(formattedImage)
.build();
ApiFuture<Operation> future = imageClient.deleteImageCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation deprecateImage(ProjectGlobalImageName image, DeprecationStatus deprecationStatusResource)
If an empty request body is given, clears the deprecation status instead.
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
DeprecationStatus deprecationStatusResource = DeprecationStatus.newBuilder().build();
Operation response = imageClient.deprecateImage(image, deprecationStatusResource);
}
image
- Image name.deprecationStatusResource
- Deprecation status for a public resource.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deprecateImage(String image, DeprecationStatus deprecationStatusResource)
If an empty request body is given, clears the deprecation status instead.
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
DeprecationStatus deprecationStatusResource = DeprecationStatus.newBuilder().build();
Operation response = imageClient.deprecateImage(image.toString(), deprecationStatusResource);
}
image
- Image name.deprecationStatusResource
- Deprecation status for a public resource.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deprecateImage(DeprecateImageHttpRequest request)
If an empty request body is given, clears the deprecation status instead.
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
String formattedImage = ProjectGlobalImageName.format("[PROJECT]", "[IMAGE]");
DeprecationStatus deprecationStatusResource = DeprecationStatus.newBuilder().build();
DeprecateImageHttpRequest request = DeprecateImageHttpRequest.newBuilder()
.setImage(formattedImage)
.setDeprecationStatusResource(deprecationStatusResource)
.build();
Operation response = imageClient.deprecateImage(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<DeprecateImageHttpRequest,Operation> deprecateImageCallable()
If an empty request body is given, clears the deprecation status instead.
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
String formattedImage = ProjectGlobalImageName.format("[PROJECT]", "[IMAGE]");
DeprecationStatus deprecationStatusResource = DeprecationStatus.newBuilder().build();
DeprecateImageHttpRequest request = DeprecateImageHttpRequest.newBuilder()
.setImage(formattedImage)
.setDeprecationStatusResource(deprecationStatusResource)
.build();
ApiFuture<Operation> future = imageClient.deprecateImageCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Image getImage(ProjectGlobalImageName image)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
Image response = imageClient.getImage(image);
}
image
- Name of the image resource to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Image getImage(String image)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
Image response = imageClient.getImage(image.toString());
}
image
- Name of the image resource to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Image getImage(GetImageHttpRequest request)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
String formattedImage = ProjectGlobalImageName.format("[PROJECT]", "[IMAGE]");
GetImageHttpRequest request = GetImageHttpRequest.newBuilder()
.setImage(formattedImage)
.build();
Image response = imageClient.getImage(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetImageHttpRequest,Image> getImageCallable()
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
String formattedImage = ProjectGlobalImageName.format("[PROJECT]", "[IMAGE]");
GetImageHttpRequest request = GetImageHttpRequest.newBuilder()
.setImage(formattedImage)
.build();
ApiFuture<Image> future = imageClient.getImageCallable().futureCall(request);
// Do something
Image response = future.get();
}
@BetaApi public final Image getFromFamilyImage(ProjectGlobalImageFamilyName family)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
ProjectGlobalImageFamilyName family = ProjectGlobalImageFamilyName.of("[PROJECT]", "[FAMILY]");
Image response = imageClient.getFromFamilyImage(family);
}
family
- Name of the image family to search for.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Image getFromFamilyImage(String family)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
ProjectGlobalImageFamilyName family = ProjectGlobalImageFamilyName.of("[PROJECT]", "[FAMILY]");
Image response = imageClient.getFromFamilyImage(family.toString());
}
family
- Name of the image family to search for.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Image getFromFamilyImage(GetFromFamilyImageHttpRequest request)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
String formattedFamily = ProjectGlobalImageFamilyName.format("[PROJECT]", "[FAMILY]");
GetFromFamilyImageHttpRequest request = GetFromFamilyImageHttpRequest.newBuilder()
.setFamily(formattedFamily)
.build();
Image response = imageClient.getFromFamilyImage(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetFromFamilyImageHttpRequest,Image> getFromFamilyImageCallable()
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
String formattedFamily = ProjectGlobalImageFamilyName.format("[PROJECT]", "[FAMILY]");
GetFromFamilyImageHttpRequest request = GetFromFamilyImageHttpRequest.newBuilder()
.setFamily(formattedFamily)
.build();
ApiFuture<Image> future = imageClient.getFromFamilyImageCallable().futureCall(request);
// Do something
Image response = future.get();
}
@BetaApi public final Policy getIamPolicyImage(ProjectGlobalImageResourceName resource)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
ProjectGlobalImageResourceName resource = ProjectGlobalImageResourceName.of("[PROJECT]", "[RESOURCE]");
Policy response = imageClient.getIamPolicyImage(resource);
}
resource
- Name or id of the resource for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Policy getIamPolicyImage(String resource)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
ProjectGlobalImageResourceName resource = ProjectGlobalImageResourceName.of("[PROJECT]", "[RESOURCE]");
Policy response = imageClient.getIamPolicyImage(resource.toString());
}
resource
- Name or id of the resource for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Policy getIamPolicyImage(GetIamPolicyImageHttpRequest request)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
String formattedResource = ProjectGlobalImageResourceName.format("[PROJECT]", "[RESOURCE]");
GetIamPolicyImageHttpRequest request = GetIamPolicyImageHttpRequest.newBuilder()
.setResource(formattedResource)
.build();
Policy response = imageClient.getIamPolicyImage(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetIamPolicyImageHttpRequest,Policy> getIamPolicyImageCallable()
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
String formattedResource = ProjectGlobalImageResourceName.format("[PROJECT]", "[RESOURCE]");
GetIamPolicyImageHttpRequest request = GetIamPolicyImageHttpRequest.newBuilder()
.setResource(formattedResource)
.build();
ApiFuture<Policy> future = imageClient.getIamPolicyImageCallable().futureCall(request);
// Do something
Policy response = future.get();
}
@BetaApi public final Operation insertImage(Boolean forceCreate, ProjectName project, Image imageResource)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
Boolean forceCreate = false;
ProjectName project = ProjectName.of("[PROJECT]");
Image imageResource = Image.newBuilder().build();
Operation response = imageClient.insertImage(forceCreate, project, imageResource);
}
forceCreate
- Force image creation if true.project
- Project ID for this request.imageResource
- Represents an Image resource.
You can use images to create boot disks for your VM instances. For more information, read Images. (== resource_for beta.images ==) (== resource_for v1.images ==)
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertImage(Boolean forceCreate, String project, Image imageResource)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
Boolean forceCreate = false;
ProjectName project = ProjectName.of("[PROJECT]");
Image imageResource = Image.newBuilder().build();
Operation response = imageClient.insertImage(forceCreate, project.toString(), imageResource);
}
forceCreate
- Force image creation if true.project
- Project ID for this request.imageResource
- Represents an Image resource.
You can use images to create boot disks for your VM instances. For more information, read Images. (== resource_for beta.images ==) (== resource_for v1.images ==)
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertImage(InsertImageHttpRequest request)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
Boolean forceCreate = false;
String formattedProject = ProjectName.format("[PROJECT]");
Image imageResource = Image.newBuilder().build();
InsertImageHttpRequest request = InsertImageHttpRequest.newBuilder()
.setForceCreate(forceCreate)
.setProject(formattedProject)
.setImageResource(imageResource)
.build();
Operation response = imageClient.insertImage(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<InsertImageHttpRequest,Operation> insertImageCallable()
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
Boolean forceCreate = false;
String formattedProject = ProjectName.format("[PROJECT]");
Image imageResource = Image.newBuilder().build();
InsertImageHttpRequest request = InsertImageHttpRequest.newBuilder()
.setForceCreate(forceCreate)
.setProject(formattedProject)
.setImageResource(imageResource)
.build();
ApiFuture<Operation> future = imageClient.insertImageCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final ImageClient.ListImagesPagedResponse listImages(ProjectName project)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (Image element : imageClient.listImages(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final ImageClient.ListImagesPagedResponse listImages(String project)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (Image element : imageClient.listImages(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final ImageClient.ListImagesPagedResponse listImages(ListImagesHttpRequest request)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListImagesHttpRequest request = ListImagesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (Image element : imageClient.listImages(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListImagesHttpRequest,ImageClient.ListImagesPagedResponse> listImagesPagedCallable()
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListImagesHttpRequest request = ListImagesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<ListImagesPagedResponse> future = imageClient.listImagesPagedCallable().futureCall(request);
// Do something
for (Image element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListImagesHttpRequest,ImageList> listImagesCallable()
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListImagesHttpRequest request = ListImagesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
ImageList response = imageClient.listImagesCallable().call(request);
for (Image 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 setIamPolicyImage(ProjectGlobalImageResourceName resource, GlobalSetPolicyRequest globalSetPolicyRequestResource)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
ProjectGlobalImageResourceName resource = ProjectGlobalImageResourceName.of("[PROJECT]", "[RESOURCE]");
GlobalSetPolicyRequest globalSetPolicyRequestResource = GlobalSetPolicyRequest.newBuilder().build();
Policy response = imageClient.setIamPolicyImage(resource, globalSetPolicyRequestResource);
}
resource
- Name or id of the resource for this request.globalSetPolicyRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Policy setIamPolicyImage(String resource, GlobalSetPolicyRequest globalSetPolicyRequestResource)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
ProjectGlobalImageResourceName resource = ProjectGlobalImageResourceName.of("[PROJECT]", "[RESOURCE]");
GlobalSetPolicyRequest globalSetPolicyRequestResource = GlobalSetPolicyRequest.newBuilder().build();
Policy response = imageClient.setIamPolicyImage(resource.toString(), globalSetPolicyRequestResource);
}
resource
- Name or id of the resource for this request.globalSetPolicyRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Policy setIamPolicyImage(SetIamPolicyImageHttpRequest request)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
String formattedResource = ProjectGlobalImageResourceName.format("[PROJECT]", "[RESOURCE]");
GlobalSetPolicyRequest globalSetPolicyRequestResource = GlobalSetPolicyRequest.newBuilder().build();
SetIamPolicyImageHttpRequest request = SetIamPolicyImageHttpRequest.newBuilder()
.setResource(formattedResource)
.setGlobalSetPolicyRequestResource(globalSetPolicyRequestResource)
.build();
Policy response = imageClient.setIamPolicyImage(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetIamPolicyImageHttpRequest,Policy> setIamPolicyImageCallable()
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
String formattedResource = ProjectGlobalImageResourceName.format("[PROJECT]", "[RESOURCE]");
GlobalSetPolicyRequest globalSetPolicyRequestResource = GlobalSetPolicyRequest.newBuilder().build();
SetIamPolicyImageHttpRequest request = SetIamPolicyImageHttpRequest.newBuilder()
.setResource(formattedResource)
.setGlobalSetPolicyRequestResource(globalSetPolicyRequestResource)
.build();
ApiFuture<Policy> future = imageClient.setIamPolicyImageCallable().futureCall(request);
// Do something
Policy response = future.get();
}
@BetaApi public final Operation setLabelsImage(ProjectGlobalImageResourceName resource, GlobalSetLabelsRequest globalSetLabelsRequestResource)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
ProjectGlobalImageResourceName resource = ProjectGlobalImageResourceName.of("[PROJECT]", "[RESOURCE]");
GlobalSetLabelsRequest globalSetLabelsRequestResource = GlobalSetLabelsRequest.newBuilder().build();
Operation response = imageClient.setLabelsImage(resource, globalSetLabelsRequestResource);
}
resource
- Name or id of the resource for this request.globalSetLabelsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setLabelsImage(String resource, GlobalSetLabelsRequest globalSetLabelsRequestResource)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
ProjectGlobalImageResourceName resource = ProjectGlobalImageResourceName.of("[PROJECT]", "[RESOURCE]");
GlobalSetLabelsRequest globalSetLabelsRequestResource = GlobalSetLabelsRequest.newBuilder().build();
Operation response = imageClient.setLabelsImage(resource.toString(), globalSetLabelsRequestResource);
}
resource
- Name or id of the resource for this request.globalSetLabelsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setLabelsImage(SetLabelsImageHttpRequest request)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
String formattedResource = ProjectGlobalImageResourceName.format("[PROJECT]", "[RESOURCE]");
GlobalSetLabelsRequest globalSetLabelsRequestResource = GlobalSetLabelsRequest.newBuilder().build();
SetLabelsImageHttpRequest request = SetLabelsImageHttpRequest.newBuilder()
.setResource(formattedResource)
.setGlobalSetLabelsRequestResource(globalSetLabelsRequestResource)
.build();
Operation response = imageClient.setLabelsImage(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetLabelsImageHttpRequest,Operation> setLabelsImageCallable()
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
String formattedResource = ProjectGlobalImageResourceName.format("[PROJECT]", "[RESOURCE]");
GlobalSetLabelsRequest globalSetLabelsRequestResource = GlobalSetLabelsRequest.newBuilder().build();
SetLabelsImageHttpRequest request = SetLabelsImageHttpRequest.newBuilder()
.setResource(formattedResource)
.setGlobalSetLabelsRequestResource(globalSetLabelsRequestResource)
.build();
ApiFuture<Operation> future = imageClient.setLabelsImageCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final TestPermissionsResponse testIamPermissionsImage(ProjectGlobalImageResourceName resource, TestPermissionsRequest testPermissionsRequestResource)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
ProjectGlobalImageResourceName resource = ProjectGlobalImageResourceName.of("[PROJECT]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response = imageClient.testIamPermissionsImage(resource, testPermissionsRequestResource);
}
resource
- Name or id of the resource for this request.testPermissionsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TestPermissionsResponse testIamPermissionsImage(String resource, TestPermissionsRequest testPermissionsRequestResource)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
ProjectGlobalImageResourceName resource = ProjectGlobalImageResourceName.of("[PROJECT]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response = imageClient.testIamPermissionsImage(resource.toString(), testPermissionsRequestResource);
}
resource
- Name or id of the resource for this request.testPermissionsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TestPermissionsResponse testIamPermissionsImage(TestIamPermissionsImageHttpRequest request)
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
String formattedResource = ProjectGlobalImageResourceName.format("[PROJECT]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestIamPermissionsImageHttpRequest request = TestIamPermissionsImageHttpRequest.newBuilder()
.setResource(formattedResource)
.setTestPermissionsRequestResource(testPermissionsRequestResource)
.build();
TestPermissionsResponse response = imageClient.testIamPermissionsImage(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<TestIamPermissionsImageHttpRequest,TestPermissionsResponse> testIamPermissionsImageCallable()
Sample code:
try (ImageClient imageClient = ImageClient.create()) {
String formattedResource = ProjectGlobalImageResourceName.format("[PROJECT]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestIamPermissionsImageHttpRequest request = TestIamPermissionsImageHttpRequest.newBuilder()
.setResource(formattedResource)
.setTestPermissionsRequestResource(testPermissionsRequestResource)
.build();
ApiFuture<TestPermissionsResponse> future = imageClient.testIamPermissionsImageCallable().futureCall(request);
// Do something
TestPermissionsResponse response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.