/// <summary>
        /// Deletes the specified model.
        /// </summary>
        /// <param name="callback">The callback.</param>
        /// <param name="modelId">The model identifier.</param>
        /// <param name="customData">Optional custom data.</param>
        /// <returns>True if the call succeeds, false if the call is unsuccessful.</returns>
        public bool DeleteModel(OnDeleteModel callback, string modelId, string customData = default(string))
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }

            if (string.IsNullOrEmpty(modelId))
            {
                throw new ArgumentNullException("modelId");
            }

            DeleteModelRequest req = new DeleteModelRequest();

            req.Callback = callback;
            req.ModelId  = modelId;
            req.Data     = customData;
            req.Parameters["version"] = NaturalLanguageUnderstandingVersion.Version;
            req.OnResponse            = OnDeleteModelResponse;
            req.Delete = true;

            RESTConnector connector = RESTConnector.GetConnector(Credentials, string.Format(ModelEndpoint, modelId));

            if (connector == null)
            {
                return(false);
            }

            return(connector.Send(req));
        }
Esempio n. 2
0
        /// <summary>Snippet for DeleteModel</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void DeleteModelRequestObject()
        {
            // Create client
            AutoMlClient autoMlClient = AutoMlClient.Create();
            // Initialize request argument(s)
            DeleteModelRequest request = new DeleteModelRequest
            {
                ModelName = ModelName.FromProjectLocationModel("[PROJECT]", "[LOCATION]", "[MODEL]"),
            };
            // Make the request
            Operation <Empty, OperationMetadata> response = autoMlClient.DeleteModel(request);

            // Poll until the returned long-running operation is complete
            Operation <Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Empty result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Empty, OperationMetadata> retrievedResponse = autoMlClient.PollOnceDeleteModel(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Empty retrievedResult = retrievedResponse.Result;
            }
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            if (!ConfirmDelete("OCIDatascienceModel", "Remove"))
            {
                return;
            }

            DeleteModelRequest request;

            try
            {
                request = new DeleteModelRequest
                {
                    ModelId      = ModelId,
                    IfMatch      = IfMatch,
                    OpcRequestId = OpcRequestId
                };

                response = client.DeleteModel(request).GetAwaiter().GetResult();
                WriteOutput(response);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
        /// <summary>
        /// Deletes the specified model.
        /// </summary>
        /// <param name="successCallback">The success callback.</param>
        /// <param name="failCallback">The fail callback.</param>
        /// <param name="modelId">The model identifier.</param>
        /// <param name="customData">Optional custom data.</param>
        /// <returns>True if the call succeeds, false if the call is unsuccessful.</returns>
        public bool DeleteModel(SuccessCallback <bool> successCallback, FailCallback failCallback, string modelId, Dictionary <string, object> customData = null)
        {
            if (successCallback == null)
            {
                throw new ArgumentNullException("successCallback");
            }
            if (failCallback == null)
            {
                throw new ArgumentNullException("failCallback");
            }

            if (string.IsNullOrEmpty(modelId))
            {
                throw new ArgumentNullException("modelId");
            }

            DeleteModelRequest req = new DeleteModelRequest();

            req.SuccessCallback       = successCallback;
            req.FailCallback          = failCallback;
            req.CustomData            = customData == null ? new Dictionary <string, object>() : customData;
            req.Parameters["version"] = NaturalLanguageUnderstandingVersion.Version;
            req.OnResponse            = OnDeleteModelResponse;
            req.Delete = true;

            RESTConnector connector = RESTConnector.GetConnector(Credentials, string.Format(ModelEndpoint, modelId));

            if (connector == null)
            {
                return(false);
            }

            return(connector.Send(req));
        }
Esempio n. 5
0
        /// <summary>Snippet for DeleteModelAsync</summary>
        public async Task DeleteModelRequestObjectAsync()
        {
            // Snippet: DeleteModelAsync(DeleteModelRequest, CallSettings)
            // Additional: DeleteModelAsync(DeleteModelRequest, CancellationToken)
            // Create client
            AutoMlClient autoMlClient = await AutoMlClient.CreateAsync();

            // Initialize request argument(s)
            DeleteModelRequest request = new DeleteModelRequest {
                Name = "",
            };
            // Make the request
            Operation <Empty, OperationMetadata> response = await autoMlClient.DeleteModelAsync(request);

            // Poll until the returned long-running operation is complete
            Operation <Empty, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            Empty result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Empty, OperationMetadata> retrievedResponse = await autoMlClient.PollOnceDeleteModelAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Empty retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Esempio n. 6
0
        /// <summary>Snippet for DeleteModelAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task DeleteModelRequestObjectAsync()
        {
            // Create client
            ModelServiceClient modelServiceClient = await ModelServiceClient.CreateAsync();

            // Initialize request argument(s)
            DeleteModelRequest request = new DeleteModelRequest
            {
                ProjectId = "",
                DatasetId = "",
                ModelId   = "",
            };
            // Make the request
            await modelServiceClient.DeleteModelAsync(request);
        }
Esempio n. 7
0
        /// <summary>Snippet for DeleteModel</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void DeleteModelRequestObject()
        {
            // Create client
            ModelServiceClient modelServiceClient = ModelServiceClient.Create();
            // Initialize request argument(s)
            DeleteModelRequest request = new DeleteModelRequest
            {
                ProjectId = "",
                DatasetId = "",
                ModelId   = "",
            };

            // Make the request
            modelServiceClient.DeleteModel(request);
        }
Esempio n. 8
0
        /// <summary>
        /// DeleteModel接口的同步版本,删除指定的部署模型。模型有两种部署模式:`无服务器模式` 和 `集群模式`。`无服务器模式` 下,模型文件被部署到无服务器云函数,即 [SCF](https://cloud.tencent.com/product/scf),用户可以在其控制台上进一步操作。`集群模式` 下,模型文件被部署到 TI-A 的计算集群中。
        /// </summary>
        /// <param name="req">参考<see cref="DeleteModelRequest"/></param>
        /// <returns>参考<see cref="DeleteModelResponse"/>实例</returns>
        public DeleteModelResponse DeleteModelSync(DeleteModelRequest req)
        {
            JsonResponseModel <DeleteModelResponse> rsp = null;

            try
            {
                var strResp = this.InternalRequestSync(req, "DeleteModel");
                rsp = JsonConvert.DeserializeObject <JsonResponseModel <DeleteModelResponse> >(strResp);
            }
            catch (JsonSerializationException e)
            {
                throw new TencentCloudSDKException(e.Message);
            }
            return(rsp.Response);
        }
        public void DeleteModel()
        {
            moq::Mock <ModelService.ModelServiceClient> mockGrpcClient = new moq::Mock <ModelService.ModelServiceClient>(moq::MockBehavior.Strict);
            DeleteModelRequest request = new DeleteModelRequest
            {
                ProjectId = "project_id43ad98b0",
                DatasetId = "dataset_id08d366d3",
                ModelId   = "model_id8abf7c47",
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.DeleteModel(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ModelServiceClient client = new ModelServiceClientImpl(mockGrpcClient.Object, null);

            client.DeleteModel(request.ProjectId, request.DatasetId, request.ModelId);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>
        /// Deletes the specified model.
        /// </summary>
        /// <param name="successCallback">The success callback.</param>
        /// <param name="failCallback">The fail callback.</param>
        /// <param name="modelId">The model identifier.</param>
        /// <param name="customData">Optional custom data.</param>
        /// <returns>True if the call succeeds, false if the call is unsuccessful.</returns>
        public bool DeleteModel(SuccessCallback <bool> successCallback, FailCallback failCallback, string modelId, Dictionary <string, object> customData = null)
        {
            if (successCallback == null)
            {
                throw new ArgumentNullException("successCallback");
            }
            if (failCallback == null)
            {
                throw new ArgumentNullException("failCallback");
            }

            if (string.IsNullOrEmpty(modelId))
            {
                throw new ArgumentNullException("modelId");
            }

            DeleteModelRequest req = new DeleteModelRequest();

            req.SuccessCallback        = successCallback;
            req.FailCallback           = failCallback;
            req.HttpMethod             = UnityWebRequest.kHttpVerbDELETE;
            req.DisableSslVerification = DisableSslVerification;
            req.CustomData             = customData == null ? new Dictionary <string, object>() : customData;
            if (req.CustomData.ContainsKey(Constants.String.CUSTOM_REQUEST_HEADERS))
            {
                foreach (KeyValuePair <string, string> kvp in req.CustomData[Constants.String.CUSTOM_REQUEST_HEADERS] as Dictionary <string, string> )
                {
                    req.Headers.Add(kvp.Key, kvp.Value);
                }
            }
            req.Parameters["version"] = NaturalLanguageUnderstandingVersion.Version;
            req.OnResponse            = OnDeleteModelResponse;
            req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=natural_language_understanding;service_version=v1;operation_id=DeleteModel";

            RESTConnector connector = RESTConnector.GetConnector(Credentials, string.Format(ModelEndpoint, modelId));

            if (connector == null)
            {
                return(false);
            }

            return(connector.Send(req));
        }
        /// <summary>Snippet for DeleteModelAsync</summary>
        public async Task DeleteModelRequestObjectAsync()
        {
            // Snippet: DeleteModelAsync(DeleteModelRequest, CallSettings)
            // Additional: DeleteModelAsync(DeleteModelRequest, CancellationToken)
            // Create client
            ModelServiceClient modelServiceClient = await ModelServiceClient.CreateAsync();

            // Initialize request argument(s)
            DeleteModelRequest request = new DeleteModelRequest
            {
                ProjectId = "",
                DatasetId = "",
                ModelId   = "",
            };
            // Make the request
            await modelServiceClient.DeleteModelAsync(request);

            // End snippet
        }
        public async stt::Task DeleteModelAsync()
        {
            moq::Mock <ModelService.ModelServiceClient> mockGrpcClient = new moq::Mock <ModelService.ModelServiceClient>(moq::MockBehavior.Strict);
            DeleteModelRequest request = new DeleteModelRequest
            {
                ProjectId = "project_id43ad98b0",
                DatasetId = "dataset_id08d366d3",
                ModelId   = "model_id8abf7c47",
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.DeleteModelAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            ModelServiceClient client = new ModelServiceClientImpl(mockGrpcClient.Object, null);
            await client.DeleteModelAsync(request.ProjectId, request.DatasetId, request.ModelId, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            await client.DeleteModelAsync(request.ProjectId, request.DatasetId, request.ModelId, st::CancellationToken.None);

            mockGrpcClient.VerifyAll();
        }
Esempio n. 13
0
        /// <summary>
        /// Deletes the specified model.
        /// </summary>
        /// <param name="successCallback">The success callback.</param>
        /// <param name="failCallback">The fail callback.</param>
        /// <param name="modelId">The model identifier.</param>
        /// <param name="customData">Optional custom data.</param>
        /// <returns>True if the call succeeds, false if the call is unsuccessful.</returns>
        public bool DeleteModel(SuccessCallback <bool> successCallback, FailCallback failCallback, string modelId, Dictionary <string, object> customData = null)
        {
            if (successCallback == null)
            {
                throw new ArgumentNullException("successCallback");
            }
            if (failCallback == null)
            {
                throw new ArgumentNullException("failCallback");
            }

            if (string.IsNullOrEmpty(modelId))
            {
                throw new ArgumentNullException("modelId");
            }

            DeleteModelRequest req = new DeleteModelRequest();

            req.SuccessCallback = successCallback;
            req.FailCallback    = failCallback;
            req.CustomData      = customData == null ? new Dictionary <string, object>() : customData;
            if (req.CustomData.ContainsKey(Constants.String.CUSTOM_REQUEST_HEADERS))
            {
                foreach (KeyValuePair <string, string> kvp in req.CustomData[Constants.String.CUSTOM_REQUEST_HEADERS] as Dictionary <string, string> )
                {
                    req.Headers.Add(kvp.Key, kvp.Value);
                }
            }
            req.Parameters["version"] = NaturalLanguageUnderstandingVersion.Version;
            req.OnResponse            = OnDeleteModelResponse;
            req.Delete = true;

            RESTConnector connector = RESTConnector.GetConnector(Credentials, string.Format(ModelEndpoint, modelId));

            if (connector == null)
            {
                return(false);
            }

            return(connector.Send(req));
        }
Esempio n. 14
0
 /// <summary>
 /// Deletes the model specified by modelId from the dataset.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>The RPC response.</returns>
 public virtual void DeleteModel(DeleteModelRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();
Esempio n. 15
0
 /// <summary>
 /// Deletes the model specified by modelId from the dataset.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public override stt::Task DeleteModelAsync(DeleteModelRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_DeleteModelRequest(ref request, ref callSettings);
     return(_callDeleteModel.Async(request, callSettings));
 }
Esempio n. 16
0
 /// <summary>
 /// Deletes the model specified by modelId from the dataset.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>The RPC response.</returns>
 public override void DeleteModel(DeleteModelRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_DeleteModelRequest(ref request, ref callSettings);
     _callDeleteModel.Sync(request, callSettings);
 }
Esempio n. 17
0
 partial void Modify_DeleteModelRequest(ref DeleteModelRequest request, ref gaxgrpc::CallSettings settings);
Esempio n. 18
0
 /// <summary>
 /// Deletes the model specified by modelId from the dataset.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public virtual stt::Task DeleteModelAsync(DeleteModelRequest request, st::CancellationToken cancellationToken) =>
 DeleteModelAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
Esempio n. 19
0
 /// <summary>
 /// Deletes the model specified by modelId from the dataset.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public virtual stt::Task DeleteModelAsync(DeleteModelRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();