Class ContainerAnalysisV1Beta1Client (2.19.0)

public class ContainerAnalysisV1Beta1Client implements BackgroundResource

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);
 
 

Inheritance

java.lang.Object > ContainerAnalysisV1Beta1Client

Implements

BackgroundResource

Static Methods

create()

public static final ContainerAnalysisV1Beta1Client create()

Constructs an instance of ContainerAnalysisV1Beta1Client with default settings.

Returns
TypeDescription
ContainerAnalysisV1Beta1Client
Exceptions
TypeDescription
IOException

create(ContainerAnalysisV1Beta1Settings settings)

public static final ContainerAnalysisV1Beta1Client create(ContainerAnalysisV1Beta1Settings settings)

Constructs an instance of ContainerAnalysisV1Beta1Client, 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
settingsContainerAnalysisV1Beta1Settings
Returns
TypeDescription
ContainerAnalysisV1Beta1Client
Exceptions
TypeDescription
IOException

create(ContainerAnalysisV1Beta1Stub stub)

public static final ContainerAnalysisV1Beta1Client create(ContainerAnalysisV1Beta1Stub stub)

Constructs an instance of ContainerAnalysisV1Beta1Client, using the given stub for making calls. This is for advanced usage - prefer to use ContainerAnalysisV1Beta1Settings}.

Parameter
NameDescription
stubContainerAnalysisV1Beta1Stub
Returns
TypeDescription
ContainerAnalysisV1Beta1Client

Constructors

ContainerAnalysisV1Beta1Client(ContainerAnalysisV1Beta1Settings settings)

protected ContainerAnalysisV1Beta1Client(ContainerAnalysisV1Beta1Settings settings)

Constructs an instance of ContainerAnalysisV1Beta1Client, 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
settingsContainerAnalysisV1Beta1Settings

ContainerAnalysisV1Beta1Client(ContainerAnalysisV1Beta1Stub stub)

protected ContainerAnalysisV1Beta1Client(ContainerAnalysisV1Beta1Stub stub)
Parameter
NameDescription
stubContainerAnalysisV1Beta1Stub

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()

getIamPolicy(IamResourceName resource)

public final Policy getIamPolicy(IamResourceName resource)

Gets the access control policy for a note or an occurrence resource. Requires containeranalysis.notes.setIamPolicy or containeranalysis.occurrences.setIamPolicy permission if the resource is a note or occurrence, respectively.

The resource takes the format projects/[PROJECT_ID]/notes/[NOTE_ID] for notes and projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] for occurrences.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
   Policy response = containerAnalysisV1Beta1Client.getIamPolicy(resource);
 }
 
Parameter
NameDescription
resourceIamResourceName

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

Returns
TypeDescription
com.google.iam.v1.Policy

getIamPolicy(GetIamPolicyRequest request)

public final Policy getIamPolicy(GetIamPolicyRequest request)

Gets the access control policy for a note or an occurrence resource. Requires containeranalysis.notes.setIamPolicy or containeranalysis.occurrences.setIamPolicy permission if the resource is a note or occurrence, respectively.

The resource takes the format projects/[PROJECT_ID]/notes/[NOTE_ID] for notes and projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] for occurrences.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
     .setResource(resource.toString())
     .build();
   Policy response = containerAnalysisV1Beta1Client.getIamPolicy(request);
 }
 
Parameter
NameDescription
requestcom.google.iam.v1.GetIamPolicyRequest

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

Returns
TypeDescription
com.google.iam.v1.Policy

getIamPolicy(String resource)

public final Policy getIamPolicy(String resource)

Gets the access control policy for a note or an occurrence resource. Requires containeranalysis.notes.setIamPolicy or containeranalysis.occurrences.setIamPolicy permission if the resource is a note or occurrence, respectively.

The resource takes the format projects/[PROJECT_ID]/notes/[NOTE_ID] for notes and projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] for occurrences.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
   Policy response = containerAnalysisV1Beta1Client.getIamPolicy(resource.toString());
 }
 
Parameter
NameDescription
resourceString

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

Returns
TypeDescription
com.google.iam.v1.Policy

getIamPolicyCallable()

public final UnaryCallable<GetIamPolicyRequest,Policy> getIamPolicyCallable()

Gets the access control policy for a note or an occurrence resource. Requires containeranalysis.notes.setIamPolicy or containeranalysis.occurrences.setIamPolicy permission if the resource is a note or occurrence, respectively.

The resource takes the format projects/[PROJECT_ID]/notes/[NOTE_ID] for notes and projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] for occurrences.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
     .setResource(resource.toString())
     .build();
   ApiFuture<Policy> future = containerAnalysisV1Beta1Client.getIamPolicyCallable().futureCall(request);
   // Do something
   Policy response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy>

getScanConfig(GetScanConfigRequest request)

public final ScanConfig getScanConfig(GetScanConfigRequest request)

Gets the specified scan configuration.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
   GetScanConfigRequest request = GetScanConfigRequest.newBuilder()
     .setName(name.toString())
     .build();
   ScanConfig response = containerAnalysisV1Beta1Client.getScanConfig(request);
 }
 
Parameter
NameDescription
requestGetScanConfigRequest

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

Returns
TypeDescription
ScanConfig

getScanConfig(ScanConfigName name)

public final ScanConfig getScanConfig(ScanConfigName name)

Gets the specified scan configuration.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
   ScanConfig response = containerAnalysisV1Beta1Client.getScanConfig(name);
 }
 
Parameter
NameDescription
nameScanConfigName

Required. The name of the scan configuration in the form of projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID].

Returns
TypeDescription
ScanConfig

getScanConfig(String name)

public final ScanConfig getScanConfig(String name)

Gets the specified scan configuration.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
   ScanConfig response = containerAnalysisV1Beta1Client.getScanConfig(name.toString());
 }
 
Parameter
NameDescription
nameString

Required. The name of the scan configuration in the form of projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID].

Returns
TypeDescription
ScanConfig

getScanConfigCallable()

public final UnaryCallable<GetScanConfigRequest,ScanConfig> getScanConfigCallable()

Gets the specified scan configuration.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
   GetScanConfigRequest request = GetScanConfigRequest.newBuilder()
     .setName(name.toString())
     .build();
   ApiFuture<ScanConfig> future = containerAnalysisV1Beta1Client.getScanConfigCallable().futureCall(request);
   // Do something
   ScanConfig response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetScanConfigRequest,ScanConfig>

getSettings()

public final ContainerAnalysisV1Beta1Settings getSettings()
Returns
TypeDescription
ContainerAnalysisV1Beta1Settings

getStub()

public ContainerAnalysisV1Beta1Stub getStub()
Returns
TypeDescription
ContainerAnalysisV1Beta1Stub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listScanConfigs(ListScanConfigsRequest request)

public final ContainerAnalysisV1Beta1Client.ListScanConfigsPagedResponse listScanConfigs(ListScanConfigsRequest request)

Lists scan configurations for the specified project.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   ListScanConfigsRequest request = ListScanConfigsRequest.newBuilder()
     .setParent(parent.toString())
     .build();
   for (ScanConfig element : containerAnalysisV1Beta1Client.listScanConfigs(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListScanConfigsRequest

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

Returns
TypeDescription
ContainerAnalysisV1Beta1Client.ListScanConfigsPagedResponse

listScanConfigs(ProjectName parent, String filter)

public final ContainerAnalysisV1Beta1Client.ListScanConfigsPagedResponse listScanConfigs(ProjectName parent, String filter)

Lists scan configurations for the specified project.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   String filter = "";
   for (ScanConfig element : containerAnalysisV1Beta1Client.listScanConfigs(parent, filter).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameters
NameDescription
parentProjectName

Required. The name of the project to list scan configurations for in the form of projects/[PROJECT_ID].

filterString

Required. The filter expression.

Returns
TypeDescription
ContainerAnalysisV1Beta1Client.ListScanConfigsPagedResponse

listScanConfigs(String parent, String filter)

public final ContainerAnalysisV1Beta1Client.ListScanConfigsPagedResponse listScanConfigs(String parent, String filter)

Lists scan configurations for the specified project.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   String filter = "";
   for (ScanConfig element : containerAnalysisV1Beta1Client.listScanConfigs(parent.toString(), filter).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameters
NameDescription
parentString

Required. The name of the project to list scan configurations for in the form of projects/[PROJECT_ID].

filterString

Required. The filter expression.

Returns
TypeDescription
ContainerAnalysisV1Beta1Client.ListScanConfigsPagedResponse

listScanConfigsCallable()

public final UnaryCallable<ListScanConfigsRequest,ListScanConfigsResponse> listScanConfigsCallable()

Lists scan configurations for the specified project.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   ListScanConfigsRequest request = ListScanConfigsRequest.newBuilder()
     .setParent(parent.toString())
     .build();
   while (true) {
     ListScanConfigsResponse response = containerAnalysisV1Beta1Client.listScanConfigsCallable().call(request);
     for (ScanConfig element : response.getScanConfigsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListScanConfigsRequest,ListScanConfigsResponse>

listScanConfigsPagedCallable()

public final UnaryCallable<ListScanConfigsRequest,ContainerAnalysisV1Beta1Client.ListScanConfigsPagedResponse> listScanConfigsPagedCallable()

Lists scan configurations for the specified project.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   ListScanConfigsRequest request = ListScanConfigsRequest.newBuilder()
     .setParent(parent.toString())
     .build();
   ApiFuture<ListScanConfigsPagedResponse> future = containerAnalysisV1Beta1Client.listScanConfigsPagedCallable().futureCall(request);
   // Do something
   for (ScanConfig element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListScanConfigsRequest,ListScanConfigsPagedResponse>

setIamPolicy(IamResourceName resource, Policy policy)

public final Policy setIamPolicy(IamResourceName resource, Policy policy)

Sets the access control policy on the specified note or occurrence. Requires containeranalysis.notes.setIamPolicy or containeranalysis.occurrences.setIamPolicy permission if the resource is a note or an occurrence, respectively.

The resource takes the format projects/[PROJECT_ID]/notes/[NOTE_ID] for notes and projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] for occurrences.

Sample code:


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

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

policycom.google.iam.v1.Policy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

Returns
TypeDescription
com.google.iam.v1.Policy

setIamPolicy(SetIamPolicyRequest request)

public final Policy setIamPolicy(SetIamPolicyRequest request)

Sets the access control policy on the specified note or occurrence. Requires containeranalysis.notes.setIamPolicy or containeranalysis.occurrences.setIamPolicy permission if the resource is a note or an occurrence, respectively.

The resource takes the format projects/[PROJECT_ID]/notes/[NOTE_ID] for notes and projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] for occurrences.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
   Policy policy = Policy.newBuilder().build();
   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
     .setResource(resource.toString())
     .setPolicy(policy)
     .build();
   Policy response = containerAnalysisV1Beta1Client.setIamPolicy(request);
 }
 
Parameter
NameDescription
requestcom.google.iam.v1.SetIamPolicyRequest

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

Returns
TypeDescription
com.google.iam.v1.Policy

setIamPolicy(String resource, Policy policy)

public final Policy setIamPolicy(String resource, Policy policy)

Sets the access control policy on the specified note or occurrence. Requires containeranalysis.notes.setIamPolicy or containeranalysis.occurrences.setIamPolicy permission if the resource is a note or an occurrence, respectively.

The resource takes the format projects/[PROJECT_ID]/notes/[NOTE_ID] for notes and projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] for occurrences.

Sample code:


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

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

policycom.google.iam.v1.Policy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

Returns
TypeDescription
com.google.iam.v1.Policy

setIamPolicyCallable()

public final UnaryCallable<SetIamPolicyRequest,Policy> setIamPolicyCallable()

Sets the access control policy on the specified note or occurrence. Requires containeranalysis.notes.setIamPolicy or containeranalysis.occurrences.setIamPolicy permission if the resource is a note or an occurrence, respectively.

The resource takes the format projects/[PROJECT_ID]/notes/[NOTE_ID] for notes and projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] for occurrences.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
   Policy policy = Policy.newBuilder().build();
   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
     .setResource(resource.toString())
     .setPolicy(policy)
     .build();
   ApiFuture<Policy> future = containerAnalysisV1Beta1Client.setIamPolicyCallable().futureCall(request);
   // Do something
   Policy response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

testIamPermissions(IamResourceName resource, List<String> permissions)

public final TestIamPermissionsResponse testIamPermissions(IamResourceName resource, List<String> permissions)

Returns the permissions that a caller has on the specified note or occurrence. Requires list permission on the project (for example, containeranalysis.notes.list).

The resource takes the format projects/[PROJECT_ID]/notes/[NOTE_ID] for notes and projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] for occurrences.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
   List<String> permissions = new ArrayList<>();
   TestIamPermissionsResponse response = containerAnalysisV1Beta1Client.testIamPermissions(resource, permissions);
 }
 
Parameters
NameDescription
resourceIamResourceName

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissionsList<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see IAM Overview.

Returns
TypeDescription
com.google.iam.v1.TestIamPermissionsResponse

testIamPermissions(TestIamPermissionsRequest request)

public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request)

Returns the permissions that a caller has on the specified note or occurrence. Requires list permission on the project (for example, containeranalysis.notes.list).

The resource takes the format projects/[PROJECT_ID]/notes/[NOTE_ID] for notes and projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] for occurrences.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
   List<String> permissions = new ArrayList<>();
   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
     .setResource(resource.toString())
     .addAllPermissions(permissions)
     .build();
   TestIamPermissionsResponse response = containerAnalysisV1Beta1Client.testIamPermissions(request);
 }
 
Parameter
NameDescription
requestcom.google.iam.v1.TestIamPermissionsRequest

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

Returns
TypeDescription
com.google.iam.v1.TestIamPermissionsResponse

testIamPermissions(String resource, List<String> permissions)

public final TestIamPermissionsResponse testIamPermissions(String resource, List<String> permissions)

Returns the permissions that a caller has on the specified note or occurrence. Requires list permission on the project (for example, containeranalysis.notes.list).

The resource takes the format projects/[PROJECT_ID]/notes/[NOTE_ID] for notes and projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] for occurrences.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
   List<String> permissions = new ArrayList<>();
   TestIamPermissionsResponse response = containerAnalysisV1Beta1Client.testIamPermissions(resource.toString(), permissions);
 }
 
Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissionsList<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see IAM Overview.

Returns
TypeDescription
com.google.iam.v1.TestIamPermissionsResponse

testIamPermissionsCallable()

public final UnaryCallable<TestIamPermissionsRequest,TestIamPermissionsResponse> testIamPermissionsCallable()

Returns the permissions that a caller has on the specified note or occurrence. Requires list permission on the project (for example, containeranalysis.notes.list).

The resource takes the format projects/[PROJECT_ID]/notes/[NOTE_ID] for notes and projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] for occurrences.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
   List<String> permissions = new ArrayList<>();
   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
     .setResource(resource.toString())
     .addAllPermissions(permissions)
     .build();
   ApiFuture<TestIamPermissionsResponse> future = containerAnalysisV1Beta1Client.testIamPermissionsCallable().futureCall(request);
   // Do something
   TestIamPermissionsResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse>

updateScanConfig(ScanConfigName name, ScanConfig scanConfig)

public final ScanConfig updateScanConfig(ScanConfigName name, ScanConfig scanConfig)

Updates the specified scan configuration.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
   ScanConfig scanConfig = ScanConfig.newBuilder().build();
   ScanConfig response = containerAnalysisV1Beta1Client.updateScanConfig(name, scanConfig);
 }
 
Parameters
NameDescription
nameScanConfigName

Required. The name of the scan configuration in the form of projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID].

scanConfigScanConfig

Required. The updated scan configuration.

Returns
TypeDescription
ScanConfig

updateScanConfig(UpdateScanConfigRequest request)

public final ScanConfig updateScanConfig(UpdateScanConfigRequest request)

Updates the specified scan configuration.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
   ScanConfig scanConfig = ScanConfig.newBuilder().build();
   UpdateScanConfigRequest request = UpdateScanConfigRequest.newBuilder()
     .setName(name.toString())
     .setScanConfig(scanConfig)
     .build();
   ScanConfig response = containerAnalysisV1Beta1Client.updateScanConfig(request);
 }
 
Parameter
NameDescription
requestUpdateScanConfigRequest

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

Returns
TypeDescription
ScanConfig

updateScanConfig(String name, ScanConfig scanConfig)

public final ScanConfig updateScanConfig(String name, ScanConfig scanConfig)

Updates the specified scan configuration.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
   ScanConfig scanConfig = ScanConfig.newBuilder().build();
   ScanConfig response = containerAnalysisV1Beta1Client.updateScanConfig(name.toString(), scanConfig);
 }
 
Parameters
NameDescription
nameString

Required. The name of the scan configuration in the form of projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID].

scanConfigScanConfig

Required. The updated scan configuration.

Returns
TypeDescription
ScanConfig

updateScanConfigCallable()

public final UnaryCallable<UpdateScanConfigRequest,ScanConfig> updateScanConfigCallable()

Updates the specified scan configuration.

Sample code:


 try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
   ScanConfig scanConfig = ScanConfig.newBuilder().build();
   UpdateScanConfigRequest request = UpdateScanConfigRequest.newBuilder()
     .setName(name.toString())
     .setScanConfig(scanConfig)
     .build();
   ApiFuture<ScanConfig> future = containerAnalysisV1Beta1Client.updateScanConfigCallable().futureCall(request);
   // Do something
   ScanConfig response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateScanConfigRequest,ScanConfig>