Skip to content

Commit

Permalink
feat: [securitycenter] Add SimulateSecurityHealthAnalyticsCustomModul…
Browse files Browse the repository at this point in the history
…e API for testing SHA custom module (#9980)

* feat: Add SimulateSecurityHealthAnalyticsCustomModule API for testing SHA custom module

PiperOrigin-RevId: 574612611

Source-Link: googleapis/googleapis@c768e7a

Source-Link: googleapis/googleapis-gen@e5502fc
Copy-Tag: eyJwIjoiamF2YS1zZWN1cml0eWNlbnRlci8uT3dsQm90LnlhbWwiLCJoIjoiZTU1MDJmYzE3ZWNlYWNhMWMyMzUyZmQyYTYxNGM3NmVjNjNlZjhlNCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Oct 19, 2023
1 parent f4b2dda commit 84afb01
Show file tree
Hide file tree
Showing 24 changed files with 7,002 additions and 663 deletions.
4 changes: 2 additions & 2 deletions java-securitycenter/README.md
Expand Up @@ -20,7 +20,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.23.0</version>
<version>26.25.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -195,7 +195,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-securitycenter.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-securitycenter/2.32.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-securitycenter/2.36.0
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
Expand Up @@ -5569,6 +5569,122 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
return stub.testIamPermissionsCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Simulates a given SecurityHealthAnalyticsCustomModule and Resource.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
* String parent = "parent-995424086";
* CustomConfig customConfig = CustomConfig.newBuilder().build();
* SimulateSecurityHealthAnalyticsCustomModuleRequest.SimulatedResource resource =
* SimulateSecurityHealthAnalyticsCustomModuleRequest.SimulatedResource.newBuilder().build();
* SimulateSecurityHealthAnalyticsCustomModuleResponse response =
* securityCenterClient.simulateSecurityHealthAnalyticsCustomModule(
* parent, customConfig, resource);
* }
* }</pre>
*
* @param parent Required. The relative resource name of the organization, project, or folder.
* See: https://cloud.google.com/apis/design/resource_names#relative_resource_name An example
* is: "organizations/{organization_id}".
* @param customConfig Required. The user specified custom configuration to test.
* @param resource Required. Resource data to simulate custom module against.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final SimulateSecurityHealthAnalyticsCustomModuleResponse
simulateSecurityHealthAnalyticsCustomModule(
String parent,
CustomConfig customConfig,
SimulateSecurityHealthAnalyticsCustomModuleRequest.SimulatedResource resource) {
SimulateSecurityHealthAnalyticsCustomModuleRequest request =
SimulateSecurityHealthAnalyticsCustomModuleRequest.newBuilder()
.setParent(parent)
.setCustomConfig(customConfig)
.setResource(resource)
.build();
return simulateSecurityHealthAnalyticsCustomModule(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Simulates a given SecurityHealthAnalyticsCustomModule and Resource.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
* SimulateSecurityHealthAnalyticsCustomModuleRequest request =
* SimulateSecurityHealthAnalyticsCustomModuleRequest.newBuilder()
* .setParent("parent-995424086")
* .setCustomConfig(CustomConfig.newBuilder().build())
* .setResource(
* SimulateSecurityHealthAnalyticsCustomModuleRequest.SimulatedResource.newBuilder()
* .build())
* .build();
* SimulateSecurityHealthAnalyticsCustomModuleResponse response =
* securityCenterClient.simulateSecurityHealthAnalyticsCustomModule(request);
* }
* }</pre>
*
* @param 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
*/
public final SimulateSecurityHealthAnalyticsCustomModuleResponse
simulateSecurityHealthAnalyticsCustomModule(
SimulateSecurityHealthAnalyticsCustomModuleRequest request) {
return simulateSecurityHealthAnalyticsCustomModuleCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Simulates a given SecurityHealthAnalyticsCustomModule and Resource.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
* SimulateSecurityHealthAnalyticsCustomModuleRequest request =
* SimulateSecurityHealthAnalyticsCustomModuleRequest.newBuilder()
* .setParent("parent-995424086")
* .setCustomConfig(CustomConfig.newBuilder().build())
* .setResource(
* SimulateSecurityHealthAnalyticsCustomModuleRequest.SimulatedResource.newBuilder()
* .build())
* .build();
* ApiFuture<SimulateSecurityHealthAnalyticsCustomModuleResponse> future =
* securityCenterClient
* .simulateSecurityHealthAnalyticsCustomModuleCallable()
* .futureCall(request);
* // Do something.
* SimulateSecurityHealthAnalyticsCustomModuleResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<
SimulateSecurityHealthAnalyticsCustomModuleRequest,
SimulateSecurityHealthAnalyticsCustomModuleResponse>
simulateSecurityHealthAnalyticsCustomModuleCallable() {
return stub.simulateSecurityHealthAnalyticsCustomModuleCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates external system. This is for a given finding.
Expand Down
Expand Up @@ -350,6 +350,18 @@ public UnaryCallSettings<SetIamPolicyRequest, Policy> setIamPolicySettings() {
return ((SecurityCenterStubSettings) getStubSettings()).testIamPermissionsSettings();
}

/**
* Returns the object with the settings used for calls to
* simulateSecurityHealthAnalyticsCustomModule.
*/
public UnaryCallSettings<
SimulateSecurityHealthAnalyticsCustomModuleRequest,
SimulateSecurityHealthAnalyticsCustomModuleResponse>
simulateSecurityHealthAnalyticsCustomModuleSettings() {
return ((SecurityCenterStubSettings) getStubSettings())
.simulateSecurityHealthAnalyticsCustomModuleSettings();
}

/** Returns the object with the settings used for calls to updateExternalSystem. */
public UnaryCallSettings<UpdateExternalSystemRequest, ExternalSystem>
updateExternalSystemSettings() {
Expand Down Expand Up @@ -796,6 +808,17 @@ public UnaryCallSettings.Builder<SetIamPolicyRequest, Policy> setIamPolicySettin
return getStubSettingsBuilder().testIamPermissionsSettings();
}

/**
* Returns the builder for the settings used for calls to
* simulateSecurityHealthAnalyticsCustomModule.
*/
public UnaryCallSettings.Builder<
SimulateSecurityHealthAnalyticsCustomModuleRequest,
SimulateSecurityHealthAnalyticsCustomModuleResponse>
simulateSecurityHealthAnalyticsCustomModuleSettings() {
return getStubSettingsBuilder().simulateSecurityHealthAnalyticsCustomModuleSettings();
}

/** Returns the builder for the settings used for calls to updateExternalSystem. */
public UnaryCallSettings.Builder<UpdateExternalSystemRequest, ExternalSystem>
updateExternalSystemSettings() {
Expand Down
Expand Up @@ -112,6 +112,9 @@
"SetMute": {
"methods": ["setMute", "setMute", "setMute", "setMuteCallable"]
},
"SimulateSecurityHealthAnalyticsCustomModule": {
"methods": ["simulateSecurityHealthAnalyticsCustomModule", "simulateSecurityHealthAnalyticsCustomModule", "simulateSecurityHealthAnalyticsCustomModuleCallable"]
},
"TestIamPermissions": {
"methods": ["testIamPermissions", "testIamPermissions", "testIamPermissions", "testIamPermissionsCallable"]
},
Expand Down
Expand Up @@ -90,6 +90,8 @@
import com.google.cloud.securitycenter.v1.SecurityMarks;
import com.google.cloud.securitycenter.v1.SetFindingStateRequest;
import com.google.cloud.securitycenter.v1.SetMuteRequest;
import com.google.cloud.securitycenter.v1.SimulateSecurityHealthAnalyticsCustomModuleRequest;
import com.google.cloud.securitycenter.v1.SimulateSecurityHealthAnalyticsCustomModuleResponse;
import com.google.cloud.securitycenter.v1.Source;
import com.google.cloud.securitycenter.v1.UpdateBigQueryExportRequest;
import com.google.cloud.securitycenter.v1.UpdateExternalSystemRequest;
Expand Down Expand Up @@ -498,6 +500,25 @@ public class GrpcSecurityCenterStub extends SecurityCenterStub {
ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance()))
.build();

private static final MethodDescriptor<
SimulateSecurityHealthAnalyticsCustomModuleRequest,
SimulateSecurityHealthAnalyticsCustomModuleResponse>
simulateSecurityHealthAnalyticsCustomModuleMethodDescriptor =
MethodDescriptor
.<SimulateSecurityHealthAnalyticsCustomModuleRequest,
SimulateSecurityHealthAnalyticsCustomModuleResponse>
newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.securitycenter.v1.SecurityCenter/SimulateSecurityHealthAnalyticsCustomModule")
.setRequestMarshaller(
ProtoUtils.marshaller(
SimulateSecurityHealthAnalyticsCustomModuleRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(
SimulateSecurityHealthAnalyticsCustomModuleResponse.getDefaultInstance()))
.build();

private static final MethodDescriptor<UpdateExternalSystemRequest, ExternalSystem>
updateExternalSystemMethodDescriptor =
MethodDescriptor.<UpdateExternalSystemRequest, ExternalSystem>newBuilder()
Expand Down Expand Up @@ -718,6 +739,10 @@ public class GrpcSecurityCenterStub extends SecurityCenterStub {
private final UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable;
private final UnaryCallable<TestIamPermissionsRequest, TestIamPermissionsResponse>
testIamPermissionsCallable;
private final UnaryCallable<
SimulateSecurityHealthAnalyticsCustomModuleRequest,
SimulateSecurityHealthAnalyticsCustomModuleResponse>
simulateSecurityHealthAnalyticsCustomModuleCallable;
private final UnaryCallable<UpdateExternalSystemRequest, ExternalSystem>
updateExternalSystemCallable;
private final UnaryCallable<UpdateFindingRequest, Finding> updateFindingCallable;
Expand Down Expand Up @@ -1152,6 +1177,22 @@ protected GrpcSecurityCenterStub(
return builder.build();
})
.build();
GrpcCallSettings<
SimulateSecurityHealthAnalyticsCustomModuleRequest,
SimulateSecurityHealthAnalyticsCustomModuleResponse>
simulateSecurityHealthAnalyticsCustomModuleTransportSettings =
GrpcCallSettings
.<SimulateSecurityHealthAnalyticsCustomModuleRequest,
SimulateSecurityHealthAnalyticsCustomModuleResponse>
newBuilder()
.setMethodDescriptor(simulateSecurityHealthAnalyticsCustomModuleMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings<UpdateExternalSystemRequest, ExternalSystem>
updateExternalSystemTransportSettings =
GrpcCallSettings.<UpdateExternalSystemRequest, ExternalSystem>newBuilder()
Expand Down Expand Up @@ -1475,6 +1516,11 @@ protected GrpcSecurityCenterStub(
testIamPermissionsTransportSettings,
settings.testIamPermissionsSettings(),
clientContext);
this.simulateSecurityHealthAnalyticsCustomModuleCallable =
callableFactory.createUnaryCallable(
simulateSecurityHealthAnalyticsCustomModuleTransportSettings,
settings.simulateSecurityHealthAnalyticsCustomModuleSettings(),
clientContext);
this.updateExternalSystemCallable =
callableFactory.createUnaryCallable(
updateExternalSystemTransportSettings,
Expand Down Expand Up @@ -1799,6 +1845,14 @@ public UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable() {
return testIamPermissionsCallable;
}

@Override
public UnaryCallable<
SimulateSecurityHealthAnalyticsCustomModuleRequest,
SimulateSecurityHealthAnalyticsCustomModuleResponse>
simulateSecurityHealthAnalyticsCustomModuleCallable() {
return simulateSecurityHealthAnalyticsCustomModuleCallable;
}

@Override
public UnaryCallable<UpdateExternalSystemRequest, ExternalSystem> updateExternalSystemCallable() {
return updateExternalSystemCallable;
Expand Down

0 comments on commit 84afb01

Please sign in to comment.