@Generated(value="by gapic-generator") @BetaApi public class ContainerAnalysisV1Beta1Client extends Object implements com.google.api.gax.core.BackgroundResource
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:
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);
Modifier and Type | Class and Description |
---|---|
static class |
ContainerAnalysisV1Beta1Client.ListScanConfigsFixedSizeCollection |
static class |
ContainerAnalysisV1Beta1Client.ListScanConfigsPage |
static class |
ContainerAnalysisV1Beta1Client.ListScanConfigsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
ContainerAnalysisV1Beta1Client(ContainerAnalysisV1Beta1Settings settings)
Constructs an instance of ContainerAnalysisV1Beta1Client, using the given settings.
|
protected |
ContainerAnalysisV1Beta1Client(ContainerAnalysisV1Beta1Stub stub) |
Modifier and Type | Method and 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(com.google.iam.v1.GetIamPolicyRequest request)
Gets the access control policy for a note or an occurrence resource.
|
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(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(String 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.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(String name,
ScanConfig scanConfig)
Updates the specified scan configuration.
|
ScanConfig |
updateScanConfig(UpdateScanConfigRequest request)
Updates the specified scan configuration.
|
com.google.api.gax.rpc.UnaryCallable<UpdateScanConfigRequest,ScanConfig> |
updateScanConfigCallable()
Updates the specified scan configuration.
|
protected ContainerAnalysisV1Beta1Client(ContainerAnalysisV1Beta1Settings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected ContainerAnalysisV1Beta1Client(ContainerAnalysisV1Beta1Stub stub)
public static final ContainerAnalysisV1Beta1Client create() throws IOException
IOException
public static final ContainerAnalysisV1Beta1Client create(ContainerAnalysisV1Beta1Settings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final ContainerAnalysisV1Beta1Client create(ContainerAnalysisV1Beta1Stub stub)
public final ContainerAnalysisV1Beta1Settings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public ContainerAnalysisV1Beta1Stub getStub()
public final com.google.iam.v1.Policy setIamPolicy(IamResourceName resource, com.google.iam.v1.Policy policy)
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);
}
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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.iam.v1.Policy setIamPolicy(String resource, com.google.iam.v1.Policy policy)
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);
}
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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
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);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()
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();
}
public final com.google.iam.v1.Policy getIamPolicy(IamResourceName resource)
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);
}
resource
- REQUIRED: The resource for which the policy is being requested. See the
operation documentation for the appropriate value for this field.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.iam.v1.Policy getIamPolicy(String resource)
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());
}
resource
- REQUIRED: The resource for which the policy is being requested. See the
operation documentation for the appropriate value for this field.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
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);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> getIamPolicyCallable()
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();
}
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(IamResourceName resource, List<String> permissions)
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);
}
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).com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(String resource, List<String> permissions)
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);
}
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).com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
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);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()
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();
}
public final ScanConfig getScanConfig(ScanConfigName name)
Sample code:
try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
ScanConfig response = containerAnalysisV1Beta1Client.getScanConfig(name);
}
name
- The name of the scan configuration in the form of
`projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final ScanConfig getScanConfig(String name)
Sample code:
try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
ScanConfig response = containerAnalysisV1Beta1Client.getScanConfig(name.toString());
}
name
- The name of the scan configuration in the form of
`projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final ScanConfig getScanConfig(GetScanConfigRequest request)
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);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetScanConfigRequest,ScanConfig> getScanConfigCallable()
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();
}
public final ContainerAnalysisV1Beta1Client.ListScanConfigsPagedResponse listScanConfigs(ProjectName parent, String filter)
Sample code:
try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
String filter = "";
for (ScanConfig element : containerAnalysisV1Beta1Client.listScanConfigs(parent, filter).iterateAll()) {
// doThingsWith(element);
}
}
parent
- The name of the project to list scan configurations for in the form of
`projects/[PROJECT_ID]`.filter
- The filter expression.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final ContainerAnalysisV1Beta1Client.ListScanConfigsPagedResponse listScanConfigs(String parent, String filter)
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);
}
}
parent
- The name of the project to list scan configurations for in the form of
`projects/[PROJECT_ID]`.filter
- The filter expression.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final ContainerAnalysisV1Beta1Client.ListScanConfigsPagedResponse listScanConfigs(ListScanConfigsRequest request)
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);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListScanConfigsRequest,ContainerAnalysisV1Beta1Client.ListScanConfigsPagedResponse> listScanConfigsPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListScanConfigsRequest,ListScanConfigsResponse> listScanConfigsCallable()
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;
}
}
}
public final ScanConfig updateScanConfig(ScanConfigName name, ScanConfig scanConfig)
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);
}
name
- The name of the scan configuration in the form of
`projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`.scanConfig
- The updated scan configuration.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final ScanConfig updateScanConfig(String name, ScanConfig scanConfig)
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);
}
name
- The name of the scan configuration in the form of
`projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`.scanConfig
- The updated scan configuration.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final ScanConfig updateScanConfig(UpdateScanConfigRequest request)
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);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateScanConfigRequest,ScanConfig> updateScanConfigCallable()
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();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.