Class ContainerAnalysisV1Beta1Client
- java.lang.Object
-
- com.google.cloud.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1Client
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
@Generated("by gapic-generator") @BetaApi public class ContainerAnalysisV1Beta1Client extends Object implements com.google.api.gax.core.BackgroundResource
Service Description: Retrieves analysis results of Cloud components such as Docker container images. The Container Analysis API is an implementation of the [Grafeas](grafeas.io) 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:
- 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.
- 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.
- 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);
ContainerAnalysisV1Beta1Settings containerAnalysisV1Beta1Settings = ContainerAnalysisV1Beta1Settings.newBuilder().setEndpoint(myEndpoint).build(); ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create(containerAnalysisV1Beta1Settings);
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ContainerAnalysisV1Beta1Client.ListScanConfigsFixedSizeCollection
static class
ContainerAnalysisV1Beta1Client.ListScanConfigsPage
static class
ContainerAnalysisV1Beta1Client.ListScanConfigsPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protected
ContainerAnalysisV1Beta1Client(ContainerAnalysisV1Beta1Settings settings)
Constructs an instance of ContainerAnalysisV1Beta1Client, using the given settings.protected
ContainerAnalysisV1Beta1Client(ContainerAnalysisV1Beta1Stub stub)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
awaitTermination(long duration, TimeUnit unit)
void
close()
static ContainerAnalysisV1Beta1Client
create()
Constructs an instance of ContainerAnalysisV1Beta1Client with default settings.static ContainerAnalysisV1Beta1Client
create(ContainerAnalysisV1Beta1Settings settings)
Constructs an instance of ContainerAnalysisV1Beta1Client, using the given settings.static ContainerAnalysisV1Beta1Client
create(ContainerAnalysisV1Beta1Stub stub)
Constructs an instance of ContainerAnalysisV1Beta1Client, using the given stub for making calls.com.google.iam.v1.Policy
getIamPolicy(IamResourceName resource)
Gets the access control policy for a note or an occurrence resource.com.google.iam.v1.Policy
getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Gets the access control policy for a note or an occurrence resource.com.google.iam.v1.Policy
getIamPolicy(String resource)
Gets the access control policy for a note or an occurrence resource.com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy>
getIamPolicyCallable()
Gets the access control policy for a note or an occurrence resource.ScanConfig
getScanConfig(GetScanConfigRequest request)
Gets the specified scan configuration.ScanConfig
getScanConfig(ScanConfigName name)
Gets the specified scan configuration.ScanConfig
getScanConfig(String name)
Gets the specified scan configuration.com.google.api.gax.rpc.UnaryCallable<GetScanConfigRequest,ScanConfig>
getScanConfigCallable()
Gets the specified scan configuration.ContainerAnalysisV1Beta1Settings
getSettings()
ContainerAnalysisV1Beta1Stub
getStub()
boolean
isShutdown()
boolean
isTerminated()
ContainerAnalysisV1Beta1Client.ListScanConfigsPagedResponse
listScanConfigs(ListScanConfigsRequest request)
Lists scan configurations for the specified project.ContainerAnalysisV1Beta1Client.ListScanConfigsPagedResponse
listScanConfigs(ProjectName parent, String filter)
Lists scan configurations for the specified project.ContainerAnalysisV1Beta1Client.ListScanConfigsPagedResponse
listScanConfigs(String parent, String filter)
Lists scan configurations for the specified project.com.google.api.gax.rpc.UnaryCallable<ListScanConfigsRequest,ListScanConfigsResponse>
listScanConfigsCallable()
Lists scan configurations for the specified project.com.google.api.gax.rpc.UnaryCallable<ListScanConfigsRequest,ContainerAnalysisV1Beta1Client.ListScanConfigsPagedResponse>
listScanConfigsPagedCallable()
Lists scan configurations for the specified project.com.google.iam.v1.Policy
setIamPolicy(IamResourceName resource, com.google.iam.v1.Policy policy)
Sets the access control policy on the specified note or occurrence.com.google.iam.v1.Policy
setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sets the access control policy on the specified note or occurrence.com.google.iam.v1.Policy
setIamPolicy(String resource, com.google.iam.v1.Policy policy)
Sets the access control policy on the specified note or occurrence.com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy>
setIamPolicyCallable()
Sets the access control policy on the specified note or occurrence.void
shutdown()
void
shutdownNow()
com.google.iam.v1.TestIamPermissionsResponse
testIamPermissions(IamResourceName resource, List<String> permissions)
Returns the permissions that a caller has on the specified note or occurrence.com.google.iam.v1.TestIamPermissionsResponse
testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Returns the permissions that a caller has on the specified note or occurrence.com.google.iam.v1.TestIamPermissionsResponse
testIamPermissions(String resource, List<String> permissions)
Returns the permissions that a caller has on the specified note or occurrence.com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse>
testIamPermissionsCallable()
Returns the permissions that a caller has on the specified note or occurrence.ScanConfig
updateScanConfig(ScanConfigName name, ScanConfig scanConfig)
Updates the specified scan configuration.ScanConfig
updateScanConfig(UpdateScanConfigRequest request)
Updates the specified scan configuration.ScanConfig
updateScanConfig(String name, ScanConfig scanConfig)
Updates the specified scan configuration.com.google.api.gax.rpc.UnaryCallable<UpdateScanConfigRequest,ScanConfig>
updateScanConfigCallable()
Updates the specified scan configuration.
-
-
-
Constructor Detail
-
ContainerAnalysisV1Beta1Client
protected ContainerAnalysisV1Beta1Client(ContainerAnalysisV1Beta1Settings settings) throws IOException
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.- Throws:
IOException
-
ContainerAnalysisV1Beta1Client
@BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected ContainerAnalysisV1Beta1Client(ContainerAnalysisV1Beta1Stub stub)
-
-
Method Detail
-
create
public static final ContainerAnalysisV1Beta1Client create() throws IOException
Constructs an instance of ContainerAnalysisV1Beta1Client with default settings.- Throws:
IOException
-
create
public static final ContainerAnalysisV1Beta1Client create(ContainerAnalysisV1Beta1Settings settings) throws IOException
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.- Throws:
IOException
-
create
@BetaApi("A restructuring of stub classes is planned, so this may break in the future") 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}.
-
getSettings
public final ContainerAnalysisV1Beta1Settings getSettings()
-
getStub
@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public ContainerAnalysisV1Beta1Stub getStub()
-
setIamPolicy
public final com.google.iam.v1.Policy setIamPolicy(IamResourceName resource, com.google.iam.v1.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:
resource
- REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.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.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
setIamPolicy
public final com.google.iam.v1.Policy setIamPolicy(String resource, com.google.iam.v1.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:
resource
- REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.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.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
setIamPolicy
public final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
setIamPolicyCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.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(); }
-
getIamPolicy
public final com.google.iam.v1.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); }
- Parameters:
resource
- REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getIamPolicy
public final com.google.iam.v1.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()); }
- Parameters:
resource
- REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getIamPolicy
public final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getIamPolicyCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.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(); }
-
testIamPermissions
public final com.google.iam.v1.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:
resource
- REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.permissions
- 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](https://cloud.google.com/iam/docs/overview#permissions).- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
testIamPermissions
public final com.google.iam.v1.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:
resource
- REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.permissions
- 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](https://cloud.google.com/iam/docs/overview#permissions).- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
testIamPermissions
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
testIamPermissionsCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.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(); }
-
getScanConfig
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); }
- Parameters:
name
- Required. The name of the scan configuration in the form of `projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getScanConfig
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()); }
- Parameters:
name
- Required. The name of the scan configuration in the form of `projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getScanConfig
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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getScanConfigCallable
public final com.google.api.gax.rpc.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(); }
-
listScanConfigs
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:
parent
- Required. The name of the project to list scan configurations for in the form of `projects/[PROJECT_ID]`.filter
- Required. The filter expression.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listScanConfigs
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:
parent
- Required. The name of the project to list scan configurations for in the form of `projects/[PROJECT_ID]`.filter
- Required. The filter expression.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listScanConfigs
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); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listScanConfigsPagedCallable
public final com.google.api.gax.rpc.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); } }
-
listScanConfigsCallable
public final com.google.api.gax.rpc.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; } } }
-
updateScanConfig
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:
name
- Required. The name of the scan configuration in the form of `projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`.scanConfig
- Required. The updated scan configuration.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateScanConfig
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:
name
- Required. The name of the scan configuration in the form of `projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`.scanConfig
- Required. The updated scan configuration.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateScanConfig
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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateScanConfigCallable
public final com.google.api.gax.rpc.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(); }
-
close
public final void close()
- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in interfacecom.google.api.gax.core.BackgroundResource
- Throws:
InterruptedException
-
-