@@ -760,6 +760,100 @@ NotebookServiceConnectionImpl::StartNotebookRuntime(
760760 polling_policy (*current), __func__);
761761}
762762
763+ future<StatusOr<google::cloud::aiplatform::v1::StopNotebookRuntimeResponse>>
764+ NotebookServiceConnectionImpl::StopNotebookRuntime (
765+ google::cloud::aiplatform::v1::StopNotebookRuntimeRequest const & request) {
766+ auto current = google::cloud::internal::SaveCurrentOptions ();
767+ auto request_copy = request;
768+ auto const idempotent =
769+ idempotency_policy (*current)->StopNotebookRuntime (request_copy);
770+ return google::cloud::internal::AsyncLongRunningOperation<
771+ google::cloud::aiplatform::v1::StopNotebookRuntimeResponse>(
772+ background_->cq (), current, std::move (request_copy),
773+ [stub = stub_](
774+ google::cloud::CompletionQueue& cq,
775+ std::shared_ptr<grpc::ClientContext> context,
776+ google::cloud::internal::ImmutableOptions options,
777+ google::cloud::aiplatform::v1::StopNotebookRuntimeRequest const &
778+ request) {
779+ return stub->AsyncStopNotebookRuntime (cq, std::move (context),
780+ std::move (options), request);
781+ },
782+ [stub = stub_](google::cloud::CompletionQueue& cq,
783+ std::shared_ptr<grpc::ClientContext> context,
784+ google::cloud::internal::ImmutableOptions options,
785+ google::longrunning::GetOperationRequest const & request) {
786+ return stub->AsyncGetOperation (cq, std::move (context),
787+ std::move (options), request);
788+ },
789+ [stub = stub_](
790+ google::cloud::CompletionQueue& cq,
791+ std::shared_ptr<grpc::ClientContext> context,
792+ google::cloud::internal::ImmutableOptions options,
793+ google::longrunning::CancelOperationRequest const & request) {
794+ return stub->AsyncCancelOperation (cq, std::move (context),
795+ std::move (options), request);
796+ },
797+ &google::cloud::internal::ExtractLongRunningResultResponse<
798+ google::cloud::aiplatform::v1::StopNotebookRuntimeResponse>,
799+ retry_policy (*current), backoff_policy (*current), idempotent,
800+ polling_policy (*current), __func__);
801+ }
802+
803+ StatusOr<google::longrunning::Operation>
804+ NotebookServiceConnectionImpl::StopNotebookRuntime (
805+ NoAwaitTag,
806+ google::cloud::aiplatform::v1::StopNotebookRuntimeRequest const & request) {
807+ auto current = google::cloud::internal::SaveCurrentOptions ();
808+ return google::cloud::internal::RetryLoop (
809+ retry_policy (*current), backoff_policy (*current),
810+ idempotency_policy (*current)->StopNotebookRuntime (request),
811+ [this ](grpc::ClientContext& context, Options const & options,
812+ google::cloud::aiplatform::v1::StopNotebookRuntimeRequest const &
813+ request) {
814+ return stub_->StopNotebookRuntime (context, options, request);
815+ },
816+ *current, request, __func__);
817+ }
818+
819+ future<StatusOr<google::cloud::aiplatform::v1::StopNotebookRuntimeResponse>>
820+ NotebookServiceConnectionImpl::StopNotebookRuntime (
821+ google::longrunning::Operation const & operation) {
822+ auto current = google::cloud::internal::SaveCurrentOptions ();
823+ if (!operation.metadata ()
824+ .Is <typename google::cloud::aiplatform::v1::
825+ StopNotebookRuntimeOperationMetadata>()) {
826+ return make_ready_future<
827+ StatusOr<google::cloud::aiplatform::v1::StopNotebookRuntimeResponse>>(
828+ internal::InvalidArgumentError (
829+ " operation does not correspond to StopNotebookRuntime" ,
830+ GCP_ERROR_INFO ().WithMetadata (" operation" ,
831+ operation.metadata ().DebugString ())));
832+ }
833+
834+ return google::cloud::internal::AsyncAwaitLongRunningOperation<
835+ google::cloud::aiplatform::v1::StopNotebookRuntimeResponse>(
836+ background_->cq (), current, operation,
837+ [stub = stub_](google::cloud::CompletionQueue& cq,
838+ std::shared_ptr<grpc::ClientContext> context,
839+ google::cloud::internal::ImmutableOptions options,
840+ google::longrunning::GetOperationRequest const & request) {
841+ return stub->AsyncGetOperation (cq, std::move (context),
842+ std::move (options), request);
843+ },
844+ [stub = stub_](
845+ google::cloud::CompletionQueue& cq,
846+ std::shared_ptr<grpc::ClientContext> context,
847+ google::cloud::internal::ImmutableOptions options,
848+ google::longrunning::CancelOperationRequest const & request) {
849+ return stub->AsyncCancelOperation (cq, std::move (context),
850+ std::move (options), request);
851+ },
852+ &google::cloud::internal::ExtractLongRunningResultResponse<
853+ google::cloud::aiplatform::v1::StopNotebookRuntimeResponse>,
854+ polling_policy (*current), __func__);
855+ }
856+
763857future<StatusOr<google::cloud::aiplatform::v1::NotebookExecutionJob>>
764858NotebookServiceConnectionImpl::CreateNotebookExecutionJob (
765859 google::cloud::aiplatform::v1::CreateNotebookExecutionJobRequest const &
0 commit comments