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: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * ReportConfigName name = ReportConfigName.of("[PROJECT]", "[LOCATION]", "[REPORT_CONFIG]"); + * ReportConfig response = storageInsightsClient.getReportConfig(name); + * } + * }+ * + *
Note: close() needs to be called on the StorageInsightsClient 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 StorageInsightsSettings to + * create(). For example: + * + *
To customize credentials: + * + *
{@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 + * StorageInsightsSettings storageInsightsSettings = + * StorageInsightsSettings.newBuilder() + * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + * .build(); + * StorageInsightsClient storageInsightsClient = + * StorageInsightsClient.create(storageInsightsSettings); + * }+ * + *
To customize the endpoint: + * + *
{@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 + * StorageInsightsSettings storageInsightsSettings = + * StorageInsightsSettings.newBuilder().setEndpoint(myEndpoint).build(); + * StorageInsightsClient storageInsightsClient = + * StorageInsightsClient.create(storageInsightsSettings); + * }+ * + *
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *
{@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 + * StorageInsightsSettings storageInsightsSettings = + * StorageInsightsSettings.newHttpJsonBuilder().build(); + * StorageInsightsClient storageInsightsClient = + * StorageInsightsClient.create(storageInsightsSettings); + * }+ * + *
Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class StorageInsightsClient implements BackgroundResource { + private final StorageInsightsSettings settings; + private final StorageInsightsStub stub; + + /** Constructs an instance of StorageInsightsClient with default settings. */ + public static final StorageInsightsClient create() throws IOException { + return create(StorageInsightsSettings.newBuilder().build()); + } + + /** + * Constructs an instance of StorageInsightsClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final StorageInsightsClient create(StorageInsightsSettings settings) + throws IOException { + return new StorageInsightsClient(settings); + } + + /** + * Constructs an instance of StorageInsightsClient, using the given stub for making calls. This is + * for advanced usage - prefer using create(StorageInsightsSettings). + */ + public static final StorageInsightsClient create(StorageInsightsStub stub) { + return new StorageInsightsClient(stub); + } + + /** + * Constructs an instance of StorageInsightsClient, 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. + */ + protected StorageInsightsClient(StorageInsightsSettings settings) throws IOException { + this.settings = settings; + this.stub = ((StorageInsightsStubSettings) settings.getStubSettings()).createStub(); + } + + protected StorageInsightsClient(StorageInsightsStub stub) { + this.settings = null; + this.stub = stub; + } + + public final StorageInsightsSettings getSettings() { + return settings; + } + + public StorageInsightsStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists ReportConfigs in a given project and location. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * for (ReportConfig element : storageInsightsClient.listReportConfigs(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Parent value for ListReportConfigsRequest + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListReportConfigsPagedResponse listReportConfigs(LocationName parent) { + ListReportConfigsRequest request = + ListReportConfigsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listReportConfigs(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists ReportConfigs in a given project and location. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + * for (ReportConfig element : storageInsightsClient.listReportConfigs(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Parent value for ListReportConfigsRequest + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListReportConfigsPagedResponse listReportConfigs(String parent) { + ListReportConfigsRequest request = + ListReportConfigsRequest.newBuilder().setParent(parent).build(); + return listReportConfigs(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists ReportConfigs in a given project and location. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * ListReportConfigsRequest request = + * ListReportConfigsRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * for (ReportConfig element : storageInsightsClient.listReportConfigs(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @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 ListReportConfigsPagedResponse listReportConfigs(ListReportConfigsRequest request) { + return listReportConfigsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists ReportConfigs in a given project and location. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * ListReportConfigsRequest request = + * ListReportConfigsRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * storageInsightsClient.listReportConfigsPagedCallable().futureCall(request); + * // Do something. + * for (ReportConfig element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * ListReportConfigsRequest request = + * ListReportConfigsRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * while (true) { + * ListReportConfigsResponse response = + * storageInsightsClient.listReportConfigsCallable().call(request); + * for (ReportConfig element : response.getReportConfigsList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }+ */ + public final UnaryCallable
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * ReportConfigName name = ReportConfigName.of("[PROJECT]", "[LOCATION]", "[REPORT_CONFIG]"); + * ReportConfig response = storageInsightsClient.getReportConfig(name); + * } + * }+ * + * @param name Required. Name of the resource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ReportConfig getReportConfig(ReportConfigName name) { + GetReportConfigRequest request = + GetReportConfigRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getReportConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single ReportConfig. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * String name = ReportConfigName.of("[PROJECT]", "[LOCATION]", "[REPORT_CONFIG]").toString(); + * ReportConfig response = storageInsightsClient.getReportConfig(name); + * } + * }+ * + * @param name Required. Name of the resource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ReportConfig getReportConfig(String name) { + GetReportConfigRequest request = GetReportConfigRequest.newBuilder().setName(name).build(); + return getReportConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single ReportConfig. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * GetReportConfigRequest request = + * GetReportConfigRequest.newBuilder() + * .setName(ReportConfigName.of("[PROJECT]", "[LOCATION]", "[REPORT_CONFIG]").toString()) + * .build(); + * ReportConfig response = storageInsightsClient.getReportConfig(request); + * } + * }+ * + * @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 ReportConfig getReportConfig(GetReportConfigRequest request) { + return getReportConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single ReportConfig. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * GetReportConfigRequest request = + * GetReportConfigRequest.newBuilder() + * .setName(ReportConfigName.of("[PROJECT]", "[LOCATION]", "[REPORT_CONFIG]").toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * storageInsightsClient.getReportConfigCallable().futureCall(request); + * // Do something. + * ReportConfig response = future.get(); + * } + * }
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * ReportConfig reportConfig = ReportConfig.newBuilder().build(); + * ReportConfig response = storageInsightsClient.createReportConfig(parent, reportConfig); + * } + * }+ * + * @param parent Required. Value for parent. + * @param reportConfig Required. The resource being created + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ReportConfig createReportConfig(LocationName parent, ReportConfig reportConfig) { + CreateReportConfigRequest request = + CreateReportConfigRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setReportConfig(reportConfig) + .build(); + return createReportConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new ReportConfig in a given project and location. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + * ReportConfig reportConfig = ReportConfig.newBuilder().build(); + * ReportConfig response = storageInsightsClient.createReportConfig(parent, reportConfig); + * } + * }+ * + * @param parent Required. Value for parent. + * @param reportConfig Required. The resource being created + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ReportConfig createReportConfig(String parent, ReportConfig reportConfig) { + CreateReportConfigRequest request = + CreateReportConfigRequest.newBuilder() + .setParent(parent) + .setReportConfig(reportConfig) + .build(); + return createReportConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new ReportConfig in a given project and location. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * CreateReportConfigRequest request = + * CreateReportConfigRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setReportConfig(ReportConfig.newBuilder().build()) + * .setRequestId("requestId693933066") + * .build(); + * ReportConfig response = storageInsightsClient.createReportConfig(request); + * } + * }+ * + * @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 ReportConfig createReportConfig(CreateReportConfigRequest request) { + return createReportConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new ReportConfig in a given project and location. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * CreateReportConfigRequest request = + * CreateReportConfigRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setReportConfig(ReportConfig.newBuilder().build()) + * .setRequestId("requestId693933066") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * storageInsightsClient.createReportConfigCallable().futureCall(request); + * // Do something. + * ReportConfig response = future.get(); + * } + * }
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * ReportConfig reportConfig = ReportConfig.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * ReportConfig response = storageInsightsClient.updateReportConfig(reportConfig, updateMask); + * } + * }+ * + * @param reportConfig Required. The resource being updated + * @param updateMask Required. Field mask is used to specify the fields to be overwritten in the + * ReportConfig resource by the update. The fields specified in the update_mask are relative + * to the resource, not the full request. A field will be overwritten if it is in the mask. If + * the user does not provide a mask then all fields will be overwritten. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ReportConfig updateReportConfig(ReportConfig reportConfig, FieldMask updateMask) { + UpdateReportConfigRequest request = + UpdateReportConfigRequest.newBuilder() + .setReportConfig(reportConfig) + .setUpdateMask(updateMask) + .build(); + return updateReportConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the parameters of a single ReportConfig. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * UpdateReportConfigRequest request = + * UpdateReportConfigRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setReportConfig(ReportConfig.newBuilder().build()) + * .setRequestId("requestId693933066") + * .build(); + * ReportConfig response = storageInsightsClient.updateReportConfig(request); + * } + * }+ * + * @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 ReportConfig updateReportConfig(UpdateReportConfigRequest request) { + return updateReportConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the parameters of a single ReportConfig. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * UpdateReportConfigRequest request = + * UpdateReportConfigRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setReportConfig(ReportConfig.newBuilder().build()) + * .setRequestId("requestId693933066") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * storageInsightsClient.updateReportConfigCallable().futureCall(request); + * // Do something. + * ReportConfig response = future.get(); + * } + * }
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * ReportConfigName name = ReportConfigName.of("[PROJECT]", "[LOCATION]", "[REPORT_CONFIG]"); + * storageInsightsClient.deleteReportConfig(name); + * } + * }+ * + * @param name Required. Name of the resource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteReportConfig(ReportConfigName name) { + DeleteReportConfigRequest request = + DeleteReportConfigRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + deleteReportConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a single ReportConfig. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * String name = ReportConfigName.of("[PROJECT]", "[LOCATION]", "[REPORT_CONFIG]").toString(); + * storageInsightsClient.deleteReportConfig(name); + * } + * }+ * + * @param name Required. Name of the resource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteReportConfig(String name) { + DeleteReportConfigRequest request = + DeleteReportConfigRequest.newBuilder().setName(name).build(); + deleteReportConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a single ReportConfig. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * DeleteReportConfigRequest request = + * DeleteReportConfigRequest.newBuilder() + * .setName(ReportConfigName.of("[PROJECT]", "[LOCATION]", "[REPORT_CONFIG]").toString()) + * .setForce(true) + * .setRequestId("requestId693933066") + * .build(); + * storageInsightsClient.deleteReportConfig(request); + * } + * }+ * + * @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 void deleteReportConfig(DeleteReportConfigRequest request) { + deleteReportConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a single ReportConfig. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * DeleteReportConfigRequest request = + * DeleteReportConfigRequest.newBuilder() + * .setName(ReportConfigName.of("[PROJECT]", "[LOCATION]", "[REPORT_CONFIG]").toString()) + * .setForce(true) + * .setRequestId("requestId693933066") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * storageInsightsClient.deleteReportConfigCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * ReportConfigName parent = ReportConfigName.of("[PROJECT]", "[LOCATION]", "[REPORT_CONFIG]"); + * for (ReportDetail element : storageInsightsClient.listReportDetails(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Parent value for ListReportDetailsRequest + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListReportDetailsPagedResponse listReportDetails(ReportConfigName parent) { + ListReportDetailsRequest request = + ListReportDetailsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listReportDetails(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists ReportDetails in a given project and location. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * String parent = ReportConfigName.of("[PROJECT]", "[LOCATION]", "[REPORT_CONFIG]").toString(); + * for (ReportDetail element : storageInsightsClient.listReportDetails(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Parent value for ListReportDetailsRequest + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListReportDetailsPagedResponse listReportDetails(String parent) { + ListReportDetailsRequest request = + ListReportDetailsRequest.newBuilder().setParent(parent).build(); + return listReportDetails(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists ReportDetails in a given project and location. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * ListReportDetailsRequest request = + * ListReportDetailsRequest.newBuilder() + * .setParent( + * ReportConfigName.of("[PROJECT]", "[LOCATION]", "[REPORT_CONFIG]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * for (ReportDetail element : storageInsightsClient.listReportDetails(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @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 ListReportDetailsPagedResponse listReportDetails(ListReportDetailsRequest request) { + return listReportDetailsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists ReportDetails in a given project and location. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * ListReportDetailsRequest request = + * ListReportDetailsRequest.newBuilder() + * .setParent( + * ReportConfigName.of("[PROJECT]", "[LOCATION]", "[REPORT_CONFIG]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * storageInsightsClient.listReportDetailsPagedCallable().futureCall(request); + * // Do something. + * for (ReportDetail element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * ListReportDetailsRequest request = + * ListReportDetailsRequest.newBuilder() + * .setParent( + * ReportConfigName.of("[PROJECT]", "[LOCATION]", "[REPORT_CONFIG]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * while (true) { + * ListReportDetailsResponse response = + * storageInsightsClient.listReportDetailsCallable().call(request); + * for (ReportDetail element : response.getReportDetailsList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }+ */ + public final UnaryCallable
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * ReportDetailName name = + * ReportDetailName.of("[PROJECT]", "[LOCATION]", "[REPORT_CONFIG]", "[REPORT_DETAIL]"); + * ReportDetail response = storageInsightsClient.getReportDetail(name); + * } + * }+ * + * @param name Required. Name of the resource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ReportDetail getReportDetail(ReportDetailName name) { + GetReportDetailRequest request = + GetReportDetailRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getReportDetail(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single ReportDetail. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * String name = + * ReportDetailName.of("[PROJECT]", "[LOCATION]", "[REPORT_CONFIG]", "[REPORT_DETAIL]") + * .toString(); + * ReportDetail response = storageInsightsClient.getReportDetail(name); + * } + * }+ * + * @param name Required. Name of the resource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ReportDetail getReportDetail(String name) { + GetReportDetailRequest request = GetReportDetailRequest.newBuilder().setName(name).build(); + return getReportDetail(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single ReportDetail. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * GetReportDetailRequest request = + * GetReportDetailRequest.newBuilder() + * .setName( + * ReportDetailName.of( + * "[PROJECT]", "[LOCATION]", "[REPORT_CONFIG]", "[REPORT_DETAIL]") + * .toString()) + * .build(); + * ReportDetail response = storageInsightsClient.getReportDetail(request); + * } + * }+ * + * @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 ReportDetail getReportDetail(GetReportDetailRequest request) { + return getReportDetailCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single ReportDetail. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * GetReportDetailRequest request = + * GetReportDetailRequest.newBuilder() + * .setName( + * ReportDetailName.of( + * "[PROJECT]", "[LOCATION]", "[REPORT_CONFIG]", "[REPORT_DETAIL]") + * .toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * storageInsightsClient.getReportDetailCallable().futureCall(request); + * // Do something. + * ReportDetail response = future.get(); + * } + * }
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * ListLocationsRequest request = + * ListLocationsRequest.newBuilder() + * .setName("name3373707") + * .setFilter("filter-1274492040") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (Location element : storageInsightsClient.listLocations(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @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 ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * ListLocationsRequest request = + * ListLocationsRequest.newBuilder() + * .setName("name3373707") + * .setFilter("filter-1274492040") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * storageInsightsClient.listLocationsPagedCallable().futureCall(request); + * // Do something. + * for (Location element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * ListLocationsRequest request = + * ListLocationsRequest.newBuilder() + * .setName("name3373707") + * .setFilter("filter-1274492040") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * while (true) { + * ListLocationsResponse response = + * storageInsightsClient.listLocationsCallable().call(request); + * for (Location element : response.getLocationsList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }+ */ + public final UnaryCallable
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + * Location response = storageInsightsClient.getLocation(request); + * } + * }+ * + * @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 Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *
Sample code: + * + *
{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) { + * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + * ApiFuture+ */ + public final UnaryCallablefuture = storageInsightsClient.getLocationCallable().futureCall(request); + * // Do something. + * Location response = future.get(); + * } + * }
The default instance has everything set to sensible defaults: + * + *
The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *
For example, to set the total timeout of getReportConfig to 30 seconds: + * + *
{@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 + * StorageInsightsSettings.Builder storageInsightsSettingsBuilder = + * StorageInsightsSettings.newBuilder(); + * storageInsightsSettingsBuilder + * .getReportConfigSettings() + * .setRetrySettings( + * storageInsightsSettingsBuilder + * .getReportConfigSettings() + * .getRetrySettings() + * .toBuilder() + * .setTotalTimeout(Duration.ofSeconds(30)) + * .build()); + * StorageInsightsSettings storageInsightsSettings = storageInsightsSettingsBuilder.build(); + * }+ */ +@Generated("by gapic-generator-java") +public class StorageInsightsSettings extends ClientSettings
Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction The interfaces provided are listed below, along with usage samples.
+ *
+ * ======================= StorageInsightsClient =======================
+ *
+ * Service Description: Service describing handlers for resources
+ *
+ * Sample for StorageInsightsClient:
+ *
+ * This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcStorageInsightsCallableFactory implements GrpcStubCallableFactory {
+
+ @Override
+ public This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcStorageInsightsStub extends StorageInsightsStub {
+ private static final MethodDescriptor This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonStorageInsightsCallableFactory
+ implements HttpJsonStubCallableFactory This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonStorageInsightsStub extends StorageInsightsStub {
+ private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build();
+
+ private static final ApiMethodDescriptor{@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 (StorageInsightsClient storageInsightsClient = StorageInsightsClient.create()) {
+ * ReportConfigName name = ReportConfigName.of("[PROJECT]", "[LOCATION]", "[REPORT_CONFIG]");
+ * ReportConfig response = storageInsightsClient.getReportConfig(name);
+ * }
+ * }
+ */
+@Generated("by gapic-generator-java")
+package com.google.cloud.storageinsights.v1;
+
+import javax.annotation.Generated;
diff --git a/java-storageinsights/google-cloud-storageinsights/src/main/java/com/google/cloud/storageinsights/v1/stub/GrpcStorageInsightsCallableFactory.java b/java-storageinsights/google-cloud-storageinsights/src/main/java/com/google/cloud/storageinsights/v1/stub/GrpcStorageInsightsCallableFactory.java
new file mode 100644
index 000000000000..d1b9fdb93bdb
--- /dev/null
+++ b/java-storageinsights/google-cloud-storageinsights/src/main/java/com/google/cloud/storageinsights/v1/stub/GrpcStorageInsightsCallableFactory.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.storageinsights.v1.stub;
+
+import com.google.api.gax.grpc.GrpcCallSettings;
+import com.google.api.gax.grpc.GrpcCallableFactory;
+import com.google.api.gax.grpc.GrpcStubCallableFactory;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.BidiStreamingCallable;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.ClientStreamingCallable;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.StreamingCallSettings;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import com.google.longrunning.stub.OperationsStub;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * gRPC callable factory implementation for the StorageInsights service API.
+ *
+ *