/** * Deletes a specific Redis instance. Instance stops serving and data is deleted. * * <p>Sample code: * * <pre><code> * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) { * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); * DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder() * .setName(name.toString()) * .build(); * Empty response = cloudRedisClient.deleteInstanceAsync(request).get(); * } * </code></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 */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty, Any> deleteInstanceAsync(DeleteInstanceRequest request) { return deleteInstanceOperationCallable().futureCall(request); }
/** * Deletes a specific Redis instance. Instance stops serving and data is deleted. * * <p>Sample code: * * <pre><code> * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) { * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); * DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder() * .setName(name.toString()) * .build(); * Empty response = cloudRedisClient.deleteInstanceAsync(request).get(); * } * </code></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 */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty, OperationMetadata> deleteInstanceAsync( DeleteInstanceRequest request) { return deleteInstanceOperationCallable().futureCall(request); }
/** * Updates a cluster within an instance. * * <p>Sample code: * * <pre><code> * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) { * ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); * int serveNodes = 0; * Cluster request = Cluster.newBuilder() * .setName(name.toString()) * .setServeNodes(serveNodes) * .build(); * Cluster response = baseBigtableInstanceAdminClient.updateClusterAsync(request).get(); * } * </code></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 */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Cluster, UpdateClusterMetadata> updateClusterAsync(Cluster request) { return updateClusterOperationCallable().futureCall(request); }
/** * Updates an app profile within an instance. * * <p>Sample code: * * <pre><code> * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) { * AppProfile appProfile = AppProfile.newBuilder().build(); * FieldMask updateMask = FieldMask.newBuilder().build(); * UpdateAppProfileRequest request = UpdateAppProfileRequest.newBuilder() * .setAppProfile(appProfile) * .setUpdateMask(updateMask) * .build(); * AppProfile response = baseBigtableInstanceAdminClient.updateAppProfileAsync(request).get(); * } * </code></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 */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<AppProfile, UpdateAppProfileMetadata> updateAppProfileAsync( UpdateAppProfileRequest request) { return updateAppProfileOperationCallable().futureCall(request); }
/** * Trains the specified agent. * * <p>Operation <response: [google.protobuf.Empty][google.protobuf.Empty], metadata: * [google.protobuf.Struct][google.protobuf.Struct]> * * <p>Sample code: * * <pre><code> * try (AgentsClient agentsClient = AgentsClient.create()) { * ProjectName parent = ProjectName.of("[PROJECT]"); * TrainAgentRequest request = TrainAgentRequest.newBuilder() * .setParent(parent.toString()) * .build(); * Empty response = agentsClient.trainAgentAsync(request).get(); * } * </code></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 */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty, Struct> trainAgentAsync(TrainAgentRequest request) { return trainAgentOperationCallable().futureCall(request); }
/** * Trains the specified agent. * * <p>Operation <response: [google.protobuf.Empty][google.protobuf.Empty], metadata: * [google.protobuf.Struct][google.protobuf.Struct]> * * <p>Sample code: * * <pre><code> * try (AgentsClient agentsClient = AgentsClient.create()) { * ProjectName parent = ProjectName.of("[PROJECT]"); * TrainAgentRequest request = TrainAgentRequest.newBuilder() * .setParent(parent.toString()) * .build(); * Empty response = agentsClient.trainAgentAsync(request).get(); * } * </code></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 */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty, Struct> trainAgentAsync(TrainAgentRequest request) { return trainAgentOperationCallable().futureCall(request); }
/** * Deletes a dataset and all of its contents. Returns empty response in the * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` * in the [metadata][google.longrunning.Operation.metadata] field. * * <p>Sample code: * * <pre><code> * try (AutoMlClient autoMlClient = AutoMlClient.create()) { * DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]"); * DeleteDatasetRequest request = DeleteDatasetRequest.newBuilder() * .setName(name.toString()) * .build(); * Empty response = autoMlClient.deleteDatasetAsync(request).get(); * } * </code></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 */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty, OperationMetadata> deleteDatasetAsync( DeleteDatasetRequest request) { return deleteDatasetOperationCallable().futureCall(request); }
/** * Imports data into a dataset. Returns an empty response in the * [response][google.longrunning.Operation.response] field when it completes. * * <p>Sample code: * * <pre><code> * try (AutoMlClient autoMlClient = AutoMlClient.create()) { * DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]"); * InputConfig inputConfig = InputConfig.newBuilder().build(); * ImportDataRequest request = ImportDataRequest.newBuilder() * .setName(name.toString()) * .setInputConfig(inputConfig) * .build(); * Empty response = autoMlClient.importDataAsync(request).get(); * } * </code></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 */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty, OperationMetadata> importDataAsync( ImportDataRequest request) { return importDataOperationCallable().futureCall(request); }
/** * Deletes a model. If a model is already deployed, this only deletes the model in AutoML BE, and * does not change the status of the deployed model in the production environment. Returns * `google.protobuf.Empty` in the [response][google.longrunning.Operation.response] field when it * completes, and `delete_details` in the [metadata][google.longrunning.Operation.metadata] field. * * <p>Sample code: * * <pre><code> * try (AutoMlClient autoMlClient = AutoMlClient.create()) { * ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); * DeleteModelRequest request = DeleteModelRequest.newBuilder() * .setName(name.toString()) * .build(); * Empty response = autoMlClient.deleteModelAsync(request).get(); * } * </code></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 */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty, OperationMetadata> deleteModelAsync( DeleteModelRequest request) { return deleteModelOperationCallable().futureCall(request); }
/** * Runs asset discovery. The discovery is tracked with a long-running operation. * * <p>This API can only be called with limited frequency for an organization. If it is called too * frequently the caller will receive a TOO_MANY_REQUESTS error. * * <p>Sample code: * * <pre><code> * try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) { * OrganizationName parent = OrganizationName.of("[ORGANIZATION]"); * RunAssetDiscoveryRequest request = RunAssetDiscoveryRequest.newBuilder() * .setParent(parent.toString()) * .build(); * Empty response = securityCenterClient.runAssetDiscoveryAsync(request).get(); * } * </code></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 */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty, Empty> runAssetDiscoveryAsync( RunAssetDiscoveryRequest request) { return runAssetDiscoveryOperationCallable().futureCall(request); }
/** * Partially updates an instance within a project. * * <p>Sample code: * * <pre><code> * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) { * Instance instance = Instance.newBuilder().build(); * FieldMask updateMask = FieldMask.newBuilder().build(); * PartialUpdateInstanceRequest request = PartialUpdateInstanceRequest.newBuilder() * .setInstance(instance) * .setUpdateMask(updateMask) * .build(); * Instance response = baseBigtableInstanceAdminClient.partialUpdateInstanceAsync(request).get(); * } * </code></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 */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Instance, UpdateInstanceMetadata> partialUpdateInstanceAsync( PartialUpdateInstanceRequest request) { return partialUpdateInstanceOperationCallable().futureCall(request); }
/** * Creates a cluster within an instance. * * <p>Sample code: * * <pre><code> * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) { * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); * String clusterId = ""; * Cluster cluster = Cluster.newBuilder().build(); * CreateClusterRequest request = CreateClusterRequest.newBuilder() * .setParent(parent.toString()) * .setClusterId(clusterId) * .setCluster(cluster) * .build(); * Cluster response = baseBigtableInstanceAdminClient.createClusterAsync(request).get(); * } * </code></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 */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Cluster, CreateClusterMetadata> createClusterAsync( CreateClusterRequest request) { return createClusterOperationCallable().futureCall(request); }
/** * Exports the specified agent to a ZIP file. * * <p>Operation <response: * [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse], metadata: * [google.protobuf.Struct][google.protobuf.Struct]> * * <p>Sample code: * * <pre><code> * try (AgentsClient agentsClient = AgentsClient.create()) { * ProjectName parent = ProjectName.of("[PROJECT]"); * ExportAgentRequest request = ExportAgentRequest.newBuilder() * .setParent(parent.toString()) * .build(); * ExportAgentResponse response = agentsClient.exportAgentAsync(request).get(); * } * </code></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 */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<ExportAgentResponse, Struct> exportAgentAsync( ExportAgentRequest request) { return exportAgentOperationCallable().futureCall(request); }
/** * Run asynchronous image detection and annotation for a list of generic files, such as PDF files, * which may contain multiple pages and multiple images per page. Progress and results can be * retrieved through the `google.longrunning.Operations` interface. `Operation.metadata` contains * `OperationMetadata` (metadata). `Operation.response` contains `AsyncBatchAnnotateFilesResponse` * (results). * * <p>Sample code: * * <pre><code> * try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) { * List<AsyncAnnotateFileRequest> requests = new ArrayList<>(); * AsyncBatchAnnotateFilesRequest request = AsyncBatchAnnotateFilesRequest.newBuilder() * .addAllRequests(requests) * .build(); * AsyncBatchAnnotateFilesResponse response = imageAnnotatorClient.asyncBatchAnnotateFilesAsync(request).get(); * } * </code></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 */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<AsyncBatchAnnotateFilesResponse, OperationMetadata> asyncBatchAnnotateFilesAsync(AsyncBatchAnnotateFilesRequest request) { return asyncBatchAnnotateFilesOperationCallable().futureCall(request); }
/** * Creates a model. Returns a Model in the [response][google.longrunning.Operation.response] field * when it completes. When you create a model, several model evaluations are created for it: a * global evaluation, and one evaluation for each annotation spec. * * <p>Sample code: * * <pre><code> * try (AutoMlClient autoMlClient = AutoMlClient.create()) { * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); * Model model = Model.newBuilder().build(); * CreateModelRequest request = CreateModelRequest.newBuilder() * .setParent(parent.toString()) * .setModel(model) * .build(); * Model response = autoMlClient.createModelAsync(request).get(); * } * </code></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 */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Model, OperationMetadata> createModelAsync( CreateModelRequest request) { return createModelOperationCallable().futureCall(request); }
@Override public OperationFuture<Instance, CreateInstanceMetadata> createInstance( String parent, String instanceId, Instance instance) throws SpannerException { CreateInstanceRequest request = CreateInstanceRequest.newBuilder() .setParent(parent) .setInstanceId(instanceId) .setInstance(instance) .build(); GrpcCallContext context = newCallContext(null, parent); return instanceAdminStub.createInstanceOperationCallable().futureCall(request, context); }
@Override public OperationFuture<Instance, UpdateInstanceMetadata> updateInstance( Instance instance, FieldMask fieldMask) throws SpannerException { UpdateInstanceRequest request = UpdateInstanceRequest.newBuilder().setInstance(instance).setFieldMask(fieldMask).build(); GrpcCallContext context = newCallContext(null, instance.getName()); return instanceAdminStub.updateInstanceOperationCallable().futureCall(request, context); }
@Override public OperationFuture<Database, CreateDatabaseMetadata> createDatabase( String instanceName, String createDatabaseStatement, Iterable<String> additionalStatements) throws SpannerException { CreateDatabaseRequest request = CreateDatabaseRequest.newBuilder() .setParent(instanceName) .setCreateStatement(createDatabaseStatement) .addAllExtraStatements(additionalStatements) .build(); GrpcCallContext context = newCallContext(null, instanceName); return databaseAdminStub.createDatabaseOperationCallable().futureCall(request, context); }
/** * Asynchronously resizes the cluster's node count. Please note that only clusters that belong to * a PRODUCTION instance can be resized. * * <pre>{@code * ApiFuture<Cluster> clusterFuture = client.resizeCluster("my-instance", "my-cluster", 30); * Cluster cluster = clusterFuture.get(); * }</pre> */ @SuppressWarnings("WeakerAccess") public ApiFuture<Cluster> resizeClusterAsync( String instanceId, String clusterId, int numServeNodes) { String name = NameUtil.formatClusterName(projectId, instanceId, clusterId); com.google.bigtable.admin.v2.Cluster request = com.google.bigtable.admin.v2.Cluster.newBuilder() .setName(name) .setServeNodes(numServeNodes) .build(); return ApiFutures.transform( stub.updateClusterOperationCallable().futureCall(request), new ApiFunction<com.google.bigtable.admin.v2.Cluster, Cluster>() { @Override public Cluster apply(com.google.bigtable.admin.v2.Cluster proto) { return Cluster.fromProto(proto); } }, MoreExecutors.directExecutor()); }
private <ReqT, RespT, MetaT> void mockOperationResult( OperationCallable<ReqT, RespT, MetaT> callable, ReqT request, RespT response) { OperationSnapshot operationSnapshot = FakeOperationSnapshot.newBuilder() .setDone(true) .setErrorCode(GrpcStatusCode.of(Code.OK)) .setName("fake-name") .setResponse(response) .build(); OperationFuture<RespT, MetaT> operationFuture = OperationFutures.immediateOperationFuture(operationSnapshot); Mockito.when(callable.futureCall(request)).thenReturn(operationFuture); }