Package com.google.cloud.devtools.containeranalysis.v1beta1 (2.4.10)

A client to Container Analysis API.

The interfaces provided are listed below, along with usage samples.

ContainerAnalysisV1Beta1Client

Service Description: Retrieves analysis results of Cloud components such as Docker container images. The Container Analysis API is an implementation of the Grafeas API.

Analysis results are stored as a series of occurrences. An Occurrence contains information about a specific analysis instance on a resource. An occurrence refers to a Note. A note contains details describing the analysis and is generally stored in a separate project, called a Provider. Multiple occurrences can refer to the same note.

For example, an SSL vulnerability could affect multiple images. In this case, there would be one note for the vulnerability and an occurrence for each image with the vulnerability referring to that note.

Sample for ContainerAnalysisV1Beta1Client:

 
 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
   Policy policy = Policy.newBuilder().build();
   Policy response = containerAnalysisV1Beta1Client.setIamPolicy(resource, policy);
 }
 
 

GrafeasV1Beta1Client

Service Description: Grafeas API.

Retrieves analysis results of Cloud components such as Docker container images.

Analysis results are stored as a series of occurrences. An Occurrence contains information about a specific analysis instance on a resource. An occurrence refers to a Note. A note contains details describing the analysis and is generally stored in a separate project, called a Provider. Multiple occurrences can refer to the same note.

For example, an SSL vulnerability could affect multiple images. In this case, there would be one note for the vulnerability and an occurrence for each image with the vulnerability referring to that note.

Sample for GrafeasV1Beta1Client:

 
 try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
   Occurrence response = grafeasV1Beta1Client.getOccurrence(name);
 }
 
 

Classes

ContainerAnalysisV1Beta1Client

Service Description: Retrieves analysis results of Cloud components such as Docker container images. The Container Analysis API is an implementation of the Grafeas API.

Analysis results are stored as a series of occurrences. An Occurrence contains information about a specific analysis instance on a resource. An occurrence refers to a Note. A note contains details describing the analysis and is generally stored in a separate project, called a Provider. Multiple occurrences can refer to the same note.

For example, an SSL vulnerability could affect multiple images. In this case, there would be one note for the vulnerability and an occurrence for each image with the vulnerability referring to that note.

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 (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
   Policy policy = Policy.newBuilder().build();
   Policy response = containerAnalysisV1Beta1Client.setIamPolicy(resource, policy);
 }
 
 

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

To customize credentials:

 
 ContainerAnalysisV1Beta1Settings containerAnalysisV1Beta1Settings =
     ContainerAnalysisV1Beta1Settings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client =
     ContainerAnalysisV1Beta1Client.create(containerAnalysisV1Beta1Settings);
 
 

To customize the endpoint:

 
 ContainerAnalysisV1Beta1Settings containerAnalysisV1Beta1Settings =
     ContainerAnalysisV1Beta1Settings.newBuilder().setEndpoint(myEndpoint).build();
 ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client =
     ContainerAnalysisV1Beta1Client.create(containerAnalysisV1Beta1Settings);
 
 

ContainerAnalysisV1Beta1Client.ListScanConfigsFixedSizeCollection

ContainerAnalysisV1Beta1Client.ListScanConfigsPage

ContainerAnalysisV1Beta1Client.ListScanConfigsPagedResponse

ContainerAnalysisV1Beta1Settings

Settings class to configure an instance of ContainerAnalysisV1Beta1Client.

The default instance has everything set to sensible defaults:

  • The default service address (containeranalysis.googleapis.com) and default port (443) are used.
  • Credentials are acquired automatically through Application Default Credentials.
  • Retries are configured for idempotent methods but not for non-idempotent methods.

The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.

For example, to set the total timeout of setIamPolicy to 30 seconds:

 
 ContainerAnalysisV1Beta1Settings.Builder containerAnalysisV1Beta1SettingsBuilder =
     ContainerAnalysisV1Beta1Settings.newBuilder();
 containerAnalysisV1Beta1SettingsBuilder
     .setIamPolicySettings()
     .setRetrySettings(
         containerAnalysisV1Beta1SettingsBuilder.setIamPolicySettings().getRetrySettings().toBuilder()
             .setTotalTimeout(Duration.ofSeconds(30))
             .build());
 ContainerAnalysisV1Beta1Settings containerAnalysisV1Beta1Settings = containerAnalysisV1Beta1SettingsBuilder.build();
 
 

ContainerAnalysisV1Beta1Settings.Builder

Builder for ContainerAnalysisV1Beta1Settings.

GrafeasV1Beta1Client

Service Description: Grafeas API.

Retrieves analysis results of Cloud components such as Docker container images.

Analysis results are stored as a series of occurrences. An Occurrence contains information about a specific analysis instance on a resource. An occurrence refers to a Note. A note contains details describing the analysis and is generally stored in a separate project, called a Provider. Multiple occurrences can refer to the same note.

For example, an SSL vulnerability could affect multiple images. In this case, there would be one note for the vulnerability and an occurrence for each image with the vulnerability referring to that note.

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 (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
   Occurrence response = grafeasV1Beta1Client.getOccurrence(name);
 }
 
 

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

To customize credentials:

 
 GrafeasV1Beta1Settings grafeasV1Beta1Settings =
     GrafeasV1Beta1Settings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 GrafeasV1Beta1Client grafeasV1Beta1Client =
     GrafeasV1Beta1Client.create(grafeasV1Beta1Settings);
 
 

To customize the endpoint:

 
 GrafeasV1Beta1Settings grafeasV1Beta1Settings =
     GrafeasV1Beta1Settings.newBuilder().setEndpoint(myEndpoint).build();
 GrafeasV1Beta1Client grafeasV1Beta1Client =
     GrafeasV1Beta1Client.create(grafeasV1Beta1Settings);
 
 

GrafeasV1Beta1Client.ListNoteOccurrencesFixedSizeCollection

GrafeasV1Beta1Client.ListNoteOccurrencesPage

GrafeasV1Beta1Client.ListNoteOccurrencesPagedResponse

GrafeasV1Beta1Client.ListNotesFixedSizeCollection

GrafeasV1Beta1Client.ListNotesPage

GrafeasV1Beta1Client.ListNotesPagedResponse

GrafeasV1Beta1Client.ListOccurrencesFixedSizeCollection

GrafeasV1Beta1Client.ListOccurrencesPage

GrafeasV1Beta1Client.ListOccurrencesPagedResponse

GrafeasV1Beta1Settings

Settings class to configure an instance of GrafeasV1Beta1Client.

The default instance has everything set to sensible defaults:

  • The default service address (containeranalysis.googleapis.com) and default port (443) are used.
  • Credentials are acquired automatically through Application Default Credentials.
  • Retries are configured for idempotent methods but not for non-idempotent methods.

The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.

For example, to set the total timeout of getOccurrence to 30 seconds:

 
 GrafeasV1Beta1Settings.Builder grafeasV1Beta1SettingsBuilder =
     GrafeasV1Beta1Settings.newBuilder();
 grafeasV1Beta1SettingsBuilder
     .getOccurrenceSettings()
     .setRetrySettings(
         grafeasV1Beta1SettingsBuilder.getOccurrenceSettings().getRetrySettings().toBuilder()
             .setTotalTimeout(Duration.ofSeconds(30))
             .build());
 GrafeasV1Beta1Settings grafeasV1Beta1Settings = grafeasV1Beta1SettingsBuilder.build();
 
 

GrafeasV1Beta1Settings.Builder

Builder for GrafeasV1Beta1Settings.