Search in sources :

Example 6 with NotificationConfig

use of com.google.cloud.securitycenter.v1.NotificationConfig in project java-securitycenter by googleapis.

the class ListNotificationConfigSnippets method listNotificationConfigs.

// [START securitycenter_list_notification_configs]
public static ImmutableList<NotificationConfig> listNotificationConfigs(String organizationId) throws IOException {
    // String organizationId = "{your-org-id}";
    OrganizationName orgName = OrganizationName.newBuilder().setOrganization(organizationId).build();
    try (SecurityCenterClient client = SecurityCenterClient.create()) {
        ListNotificationConfigsPagedResponse response = client.listNotificationConfigs(orgName);
        ImmutableList<NotificationConfig> notificationConfigs = ImmutableList.copyOf(response.iterateAll());
        System.out.println(String.format("List notifications response: %s", response.getPage().getValues()));
        return notificationConfigs;
    }
}
Also used : OrganizationName(com.google.cloud.securitycenter.v1.OrganizationName) ListNotificationConfigsPagedResponse(com.google.cloud.securitycenter.v1.SecurityCenterClient.ListNotificationConfigsPagedResponse) NotificationConfig(com.google.cloud.securitycenter.v1.NotificationConfig) SecurityCenterClient(com.google.cloud.securitycenter.v1.SecurityCenterClient)

Aggregations

NotificationConfig (com.google.cloud.securitycenter.v1.NotificationConfig)4 SecurityCenterClient (com.google.cloud.securitycenter.v1.SecurityCenterClient)4 ListNotificationConfigsPagedResponse (com.google.cloud.securitycenter.v1.SecurityCenterClient.ListNotificationConfigsPagedResponse)3 AbstractMessage (com.google.protobuf.AbstractMessage)2 Test (org.junit.Test)2 CreateNotificationConfigRequest (com.google.cloud.securitycenter.v1.CreateNotificationConfigRequest)1 OrganizationName (com.google.cloud.securitycenter.v1.OrganizationName)1 ByteString (com.google.protobuf.ByteString)1 FieldMask (com.google.protobuf.FieldMask)1