Class ImagesClient (1.7.2)

public class ImagesClient implements BackgroundResource

Service Description: The Images API.

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 (ImagesClient imagesClient = ImagesClient.create()) {
   String project = "project-309310695";
   String image = "image100313435";
   Image response = imagesClient.get(project, image);
 }
 

Note: close() needs to be called on the ImagesClient 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 ImagesSettings to create(). For example:

To customize credentials:


 ImagesSettings imagesSettings =
     ImagesSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ImagesClient imagesClient = ImagesClient.create(imagesSettings);
 

To customize the endpoint:


 ImagesSettings imagesSettings = ImagesSettings.newBuilder().setEndpoint(myEndpoint).build();
 ImagesClient imagesClient = ImagesClient.create(imagesSettings);
 

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

Inheritance

java.lang.Object > ImagesClient

Implements

BackgroundResource

Static Methods

create()

public static final ImagesClient create()

Constructs an instance of ImagesClient with default settings.

Returns
TypeDescription
ImagesClient
Exceptions
TypeDescription
IOException

create(ImagesSettings settings)

public static final ImagesClient create(ImagesSettings settings)

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

Parameter
NameDescription
settingsImagesSettings
Returns
TypeDescription
ImagesClient
Exceptions
TypeDescription
IOException

create(ImagesStub stub)

public static final ImagesClient create(ImagesStub stub)

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

Parameter
NameDescription
stubImagesStub
Returns
TypeDescription
ImagesClient

Constructors

ImagesClient(ImagesSettings settings)

protected ImagesClient(ImagesSettings settings)

Constructs an instance of ImagesClient, 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
NameDescription
settingsImagesSettings

ImagesClient(ImagesStub stub)

protected ImagesClient(ImagesStub stub)
Parameter
NameDescription
stubImagesStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

deleteAsync(DeleteImageRequest request)

public final OperationFuture<Operation,Operation> deleteAsync(DeleteImageRequest request)

Deletes the specified image.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   DeleteImageRequest request =
       DeleteImageRequest.newBuilder()
           .setImage("image100313435")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   Operation response = imagesClient.deleteAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteImageRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

deleteAsync(String project, String image)

public final OperationFuture<Operation,Operation> deleteAsync(String project, String image)

Deletes the specified image.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   String project = "project-309310695";
   String image = "image100313435";
   Operation response = imagesClient.deleteAsync(project, image).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

imageString

Name of the image resource to delete.

Returns
TypeDescription
OperationFuture<Operation,Operation>

deleteCallable()

public final UnaryCallable<DeleteImageRequest,Operation> deleteCallable()

Deletes the specified image.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   DeleteImageRequest request =
       DeleteImageRequest.newBuilder()
           .setImage("image100313435")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = imagesClient.deleteCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteImageRequest,Operation>

deleteOperationCallable()

public final OperationCallable<DeleteImageRequest,Operation,Operation> deleteOperationCallable()

Deletes the specified image.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   DeleteImageRequest request =
       DeleteImageRequest.newBuilder()
           .setImage("image100313435")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture
Returns
TypeDescription
OperationCallable<DeleteImageRequest,Operation,Operation>

deprecateAsync(DeprecateImageRequest request)

public final OperationFuture<Operation,Operation> deprecateAsync(DeprecateImageRequest request)

Sets the deprecation status of an image. If an empty request body is given, clears the deprecation status instead.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   DeprecateImageRequest request =
       DeprecateImageRequest.newBuilder()
           .setDeprecationStatusResource(DeprecationStatus.newBuilder().build())
           .setImage("image100313435")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   Operation response = imagesClient.deprecateAsync(request).get();
 }
 
Parameter
NameDescription
requestDeprecateImageRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

deprecateAsync(String project, String image, DeprecationStatus deprecationStatusResource)

public final OperationFuture<Operation,Operation> deprecateAsync(String project, String image, DeprecationStatus deprecationStatusResource)

Sets the deprecation status of an image. If an empty request body is given, clears the deprecation status instead.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   String project = "project-309310695";
   String image = "image100313435";
   DeprecationStatus deprecationStatusResource = DeprecationStatus.newBuilder().build();
   Operation response =
       imagesClient.deprecateAsync(project, image, deprecationStatusResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

imageString

Image name.

deprecationStatusResourceDeprecationStatus

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

deprecateCallable()

public final UnaryCallable<DeprecateImageRequest,Operation> deprecateCallable()

Sets the deprecation status of an image. If an empty request body is given, clears the deprecation status instead.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   DeprecateImageRequest request =
       DeprecateImageRequest.newBuilder()
           .setDeprecationStatusResource(DeprecationStatus.newBuilder().build())
           .setImage("image100313435")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = imagesClient.deprecateCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeprecateImageRequest,Operation>

deprecateOperationCallable()

public final OperationCallable<DeprecateImageRequest,Operation,Operation> deprecateOperationCallable()

Sets the deprecation status of an image. If an empty request body is given, clears the deprecation status instead.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   DeprecateImageRequest request =
       DeprecateImageRequest.newBuilder()
           .setDeprecationStatusResource(DeprecationStatus.newBuilder().build())
           .setImage("image100313435")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture
Returns
TypeDescription
OperationCallable<DeprecateImageRequest,Operation,Operation>

get(GetImageRequest request)

public final Image get(GetImageRequest request)

Returns the specified image. Gets a list of available images by making a list() request.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   GetImageRequest request =
       GetImageRequest.newBuilder()
           .setImage("image100313435")
           .setProject("project-309310695")
           .build();
   Image response = imagesClient.get(request);
 }
 
Parameter
NameDescription
requestGetImageRequest

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

Returns
TypeDescription
Image

get(String project, String image)

public final Image get(String project, String image)

Returns the specified image. Gets a list of available images by making a list() request.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   String project = "project-309310695";
   String image = "image100313435";
   Image response = imagesClient.get(project, image);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

imageString

Name of the image resource to return.

Returns
TypeDescription
Image

getCallable()

public final UnaryCallable<GetImageRequest,Image> getCallable()

Returns the specified image. Gets a list of available images by making a list() request.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   GetImageRequest request =
       GetImageRequest.newBuilder()
           .setImage("image100313435")
           .setProject("project-309310695")
           .build();
   ApiFuture<Image> future = imagesClient.getCallable().futureCall(request);
   // Do something.
   Image response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetImageRequest,Image>

getFromFamily(GetFromFamilyImageRequest request)

public final Image getFromFamily(GetFromFamilyImageRequest request)

Returns the latest image that is part of an image family and is not deprecated.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   GetFromFamilyImageRequest request =
       GetFromFamilyImageRequest.newBuilder()
           .setFamily("family-1281860764")
           .setProject("project-309310695")
           .build();
   Image response = imagesClient.getFromFamily(request);
 }
 
Parameter
NameDescription
requestGetFromFamilyImageRequest

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

Returns
TypeDescription
Image

getFromFamily(String project, String family)

public final Image getFromFamily(String project, String family)

Returns the latest image that is part of an image family and is not deprecated.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   String project = "project-309310695";
   String family = "family-1281860764";
   Image response = imagesClient.getFromFamily(project, family);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

familyString

Name of the image family to search for.

Returns
TypeDescription
Image

getFromFamilyCallable()

public final UnaryCallable<GetFromFamilyImageRequest,Image> getFromFamilyCallable()

Returns the latest image that is part of an image family and is not deprecated.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   GetFromFamilyImageRequest request =
       GetFromFamilyImageRequest.newBuilder()
           .setFamily("family-1281860764")
           .setProject("project-309310695")
           .build();
   ApiFuture<Image> future = imagesClient.getFromFamilyCallable().futureCall(request);
   // Do something.
   Image response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetFromFamilyImageRequest,Image>

getIamPolicy(GetIamPolicyImageRequest request)

public final Policy getIamPolicy(GetIamPolicyImageRequest request)

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   GetIamPolicyImageRequest request =
       GetIamPolicyImageRequest.newBuilder()
           .setOptionsRequestedPolicyVersion(-574521795)
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .build();
   Policy response = imagesClient.getIamPolicy(request);
 }
 
Parameter
NameDescription
requestGetIamPolicyImageRequest

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

Returns
TypeDescription
Policy

getIamPolicy(String project, String resource)

public final Policy getIamPolicy(String project, String resource)

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   String project = "project-309310695";
   String resource = "resource-341064690";
   Policy response = imagesClient.getIamPolicy(project, resource);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

resourceString

Name or id of the resource for this request.

Returns
TypeDescription
Policy

getIamPolicyCallable()

public final UnaryCallable<GetIamPolicyImageRequest,Policy> getIamPolicyCallable()

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   GetIamPolicyImageRequest request =
       GetIamPolicyImageRequest.newBuilder()
           .setOptionsRequestedPolicyVersion(-574521795)
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .build();
   ApiFuture<Policy> future = imagesClient.getIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetIamPolicyImageRequest,Policy>

getSettings()

public final ImagesSettings getSettings()
Returns
TypeDescription
ImagesSettings

getStub()

public ImagesStub getStub()
Returns
TypeDescription
ImagesStub

insertAsync(InsertImageRequest request)

public final OperationFuture<Operation,Operation> insertAsync(InsertImageRequest request)

Creates an image in the specified project using the data included in the request.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   InsertImageRequest request =
       InsertImageRequest.newBuilder()
           .setForceCreate(true)
           .setImageResource(Image.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   Operation response = imagesClient.insertAsync(request).get();
 }
 
Parameter
NameDescription
requestInsertImageRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

insertAsync(String project, Image imageResource)

public final OperationFuture<Operation,Operation> insertAsync(String project, Image imageResource)

Creates an image in the specified project using the data included in the request.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   String project = "project-309310695";
   Image imageResource = Image.newBuilder().build();
   Operation response = imagesClient.insertAsync(project, imageResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

imageResourceImage

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

insertCallable()

public final UnaryCallable<InsertImageRequest,Operation> insertCallable()

Creates an image in the specified project using the data included in the request.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   InsertImageRequest request =
       InsertImageRequest.newBuilder()
           .setForceCreate(true)
           .setImageResource(Image.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = imagesClient.insertCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<InsertImageRequest,Operation>

insertOperationCallable()

public final OperationCallable<InsertImageRequest,Operation,Operation> insertOperationCallable()

Creates an image in the specified project using the data included in the request.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   InsertImageRequest request =
       InsertImageRequest.newBuilder()
           .setForceCreate(true)
           .setImageResource(Image.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture
Returns
TypeDescription
OperationCallable<InsertImageRequest,Operation,Operation>

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

list(ListImagesRequest request)

public final ImagesClient.ListPagedResponse list(ListImagesRequest request)

Retrieves the list of custom images available to the specified project. Custom images are images you create that belong to your project. This method does not get any images that belong to other projects, including publicly-available images, like Debian 8. If you want to get a list of publicly-available images, use this method to make a request to the respective image project, such as debian-cloud or windows-cloud.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   ListImagesRequest request =
       ListImagesRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .build();
   for (Image element : imagesClient.list(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListImagesRequest

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

Returns
TypeDescription
ImagesClient.ListPagedResponse

list(String project)

public final ImagesClient.ListPagedResponse list(String project)

Retrieves the list of custom images available to the specified project. Custom images are images you create that belong to your project. This method does not get any images that belong to other projects, including publicly-available images, like Debian 8. If you want to get a list of publicly-available images, use this method to make a request to the respective image project, such as debian-cloud or windows-cloud.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   String project = "project-309310695";
   for (Image element : imagesClient.list(project).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
projectString

Project ID for this request.

Returns
TypeDescription
ImagesClient.ListPagedResponse

listCallable()

public final UnaryCallable<ListImagesRequest,ImageList> listCallable()

Retrieves the list of custom images available to the specified project. Custom images are images you create that belong to your project. This method does not get any images that belong to other projects, including publicly-available images, like Debian 8. If you want to get a list of publicly-available images, use this method to make a request to the respective image project, such as debian-cloud or windows-cloud.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   ListImagesRequest request =
       ListImagesRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .build();
   while (true) {
     ImageList response = imagesClient.listCallable().call(request);
     for (Image element : response.getResponsesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListImagesRequest,ImageList>

listPagedCallable()

public final UnaryCallable<ListImagesRequest,ImagesClient.ListPagedResponse> listPagedCallable()

Retrieves the list of custom images available to the specified project. Custom images are images you create that belong to your project. This method does not get any images that belong to other projects, including publicly-available images, like Debian 8. If you want to get a list of publicly-available images, use this method to make a request to the respective image project, such as debian-cloud or windows-cloud.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   ListImagesRequest request =
       ListImagesRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .build();
   ApiFuture<Image> future = imagesClient.listPagedCallable().futureCall(request);
   // Do something.
   for (Image element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListImagesRequest,ListPagedResponse>

patchAsync(PatchImageRequest request)

public final OperationFuture<Operation,Operation> patchAsync(PatchImageRequest request)

Patches the specified image with the data included in the request. Only the following fields can be modified: family, description, deprecation status.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   PatchImageRequest request =
       PatchImageRequest.newBuilder()
           .setImage("image100313435")
           .setImageResource(Image.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   Operation response = imagesClient.patchAsync(request).get();
 }
 
Parameter
NameDescription
requestPatchImageRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

patchAsync(String project, String image, Image imageResource)

public final OperationFuture<Operation,Operation> patchAsync(String project, String image, Image imageResource)

Patches the specified image with the data included in the request. Only the following fields can be modified: family, description, deprecation status.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   String project = "project-309310695";
   String image = "image100313435";
   Image imageResource = Image.newBuilder().build();
   Operation response = imagesClient.patchAsync(project, image, imageResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

imageString

Name of the image resource to patch.

imageResourceImage

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

patchCallable()

public final UnaryCallable<PatchImageRequest,Operation> patchCallable()

Patches the specified image with the data included in the request. Only the following fields can be modified: family, description, deprecation status.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   PatchImageRequest request =
       PatchImageRequest.newBuilder()
           .setImage("image100313435")
           .setImageResource(Image.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = imagesClient.patchCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<PatchImageRequest,Operation>

patchOperationCallable()

public final OperationCallable<PatchImageRequest,Operation,Operation> patchOperationCallable()

Patches the specified image with the data included in the request. Only the following fields can be modified: family, description, deprecation status.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   PatchImageRequest request =
       PatchImageRequest.newBuilder()
           .setImage("image100313435")
           .setImageResource(Image.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture
Returns
TypeDescription
OperationCallable<PatchImageRequest,Operation,Operation>

setIamPolicy(SetIamPolicyImageRequest request)

public final Policy setIamPolicy(SetIamPolicyImageRequest request)

Sets the access control policy on the specified resource. Replaces any existing policy.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   SetIamPolicyImageRequest request =
       SetIamPolicyImageRequest.newBuilder()
           .setGlobalSetPolicyRequestResource(GlobalSetPolicyRequest.newBuilder().build())
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .build();
   Policy response = imagesClient.setIamPolicy(request);
 }
 
Parameter
NameDescription
requestSetIamPolicyImageRequest

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

Returns
TypeDescription
Policy

setIamPolicy(String project, String resource, GlobalSetPolicyRequest globalSetPolicyRequestResource)

public final Policy setIamPolicy(String project, String resource, GlobalSetPolicyRequest globalSetPolicyRequestResource)

Sets the access control policy on the specified resource. Replaces any existing policy.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   String project = "project-309310695";
   String resource = "resource-341064690";
   GlobalSetPolicyRequest globalSetPolicyRequestResource =
       GlobalSetPolicyRequest.newBuilder().build();
   Policy response =
       imagesClient.setIamPolicy(project, resource, globalSetPolicyRequestResource);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

resourceString

Name or id of the resource for this request.

globalSetPolicyRequestResourceGlobalSetPolicyRequest

The body resource for this request

Returns
TypeDescription
Policy

setIamPolicyCallable()

public final UnaryCallable<SetIamPolicyImageRequest,Policy> setIamPolicyCallable()

Sets the access control policy on the specified resource. Replaces any existing policy.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   SetIamPolicyImageRequest request =
       SetIamPolicyImageRequest.newBuilder()
           .setGlobalSetPolicyRequestResource(GlobalSetPolicyRequest.newBuilder().build())
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .build();
   ApiFuture<Policy> future = imagesClient.setIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetIamPolicyImageRequest,Policy>

setLabelsAsync(SetLabelsImageRequest request)

public final OperationFuture<Operation,Operation> setLabelsAsync(SetLabelsImageRequest request)

Sets the labels on an image. To learn more about labels, read the Labeling Resources documentation.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   SetLabelsImageRequest request =
       SetLabelsImageRequest.newBuilder()
           .setGlobalSetLabelsRequestResource(GlobalSetLabelsRequest.newBuilder().build())
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .build();
   Operation response = imagesClient.setLabelsAsync(request).get();
 }
 
Parameter
NameDescription
requestSetLabelsImageRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

setLabelsAsync(String project, String resource, GlobalSetLabelsRequest globalSetLabelsRequestResource)

public final OperationFuture<Operation,Operation> setLabelsAsync(String project, String resource, GlobalSetLabelsRequest globalSetLabelsRequestResource)

Sets the labels on an image. To learn more about labels, read the Labeling Resources documentation.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   String project = "project-309310695";
   String resource = "resource-341064690";
   GlobalSetLabelsRequest globalSetLabelsRequestResource =
       GlobalSetLabelsRequest.newBuilder().build();
   Operation response =
       imagesClient.setLabelsAsync(project, resource, globalSetLabelsRequestResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

resourceString

Name or id of the resource for this request.

globalSetLabelsRequestResourceGlobalSetLabelsRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

setLabelsCallable()

public final UnaryCallable<SetLabelsImageRequest,Operation> setLabelsCallable()

Sets the labels on an image. To learn more about labels, read the Labeling Resources documentation.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   SetLabelsImageRequest request =
       SetLabelsImageRequest.newBuilder()
           .setGlobalSetLabelsRequestResource(GlobalSetLabelsRequest.newBuilder().build())
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .build();
   ApiFuture<Operation> future = imagesClient.setLabelsCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetLabelsImageRequest,Operation>

setLabelsOperationCallable()

public final OperationCallable<SetLabelsImageRequest,Operation,Operation> setLabelsOperationCallable()

Sets the labels on an image. To learn more about labels, read the Labeling Resources documentation.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   SetLabelsImageRequest request =
       SetLabelsImageRequest.newBuilder()
           .setGlobalSetLabelsRequestResource(GlobalSetLabelsRequest.newBuilder().build())
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .build();
   OperationFuture
Returns
TypeDescription
OperationCallable<SetLabelsImageRequest,Operation,Operation>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

testIamPermissions(TestIamPermissionsImageRequest request)

public final TestPermissionsResponse testIamPermissions(TestIamPermissionsImageRequest request)

Returns permissions that a caller has on the specified resource.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   TestIamPermissionsImageRequest request =
       TestIamPermissionsImageRequest.newBuilder()
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
           .build();
   TestPermissionsResponse response = imagesClient.testIamPermissions(request);
 }
 
Parameter
NameDescription
requestTestIamPermissionsImageRequest

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

Returns
TypeDescription
TestPermissionsResponse

testIamPermissions(String project, String resource, TestPermissionsRequest testPermissionsRequestResource)

public final TestPermissionsResponse testIamPermissions(String project, String resource, TestPermissionsRequest testPermissionsRequestResource)

Returns permissions that a caller has on the specified resource.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   String project = "project-309310695";
   String resource = "resource-341064690";
   TestPermissionsRequest testPermissionsRequestResource =
       TestPermissionsRequest.newBuilder().build();
   TestPermissionsResponse response =
       imagesClient.testIamPermissions(project, resource, testPermissionsRequestResource);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

resourceString

Name or id of the resource for this request.

testPermissionsRequestResourceTestPermissionsRequest

The body resource for this request

Returns
TypeDescription
TestPermissionsResponse

testIamPermissionsCallable()

public final UnaryCallable<TestIamPermissionsImageRequest,TestPermissionsResponse> testIamPermissionsCallable()

Returns permissions that a caller has on the specified resource.

Sample code:


 try (ImagesClient imagesClient = ImagesClient.create()) {
   TestIamPermissionsImageRequest request =
       TestIamPermissionsImageRequest.newBuilder()
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
           .build();
   ApiFuture
Returns
TypeDescription
UnaryCallable<TestIamPermissionsImageRequest,TestPermissionsResponse>