Ejemplo n.º 1
0
        /// <summary>Snippet for DeletePredictionApiKeyRegistration</summary>
        public void DeletePredictionApiKeyRegistrationResourceNames()
        {
            // Snippet: DeletePredictionApiKeyRegistration(PredictionApiKeyRegistrationName, CallSettings)
            // Create client
            PredictionApiKeyRegistryClient predictionApiKeyRegistryClient = PredictionApiKeyRegistryClient.Create();
            // Initialize request argument(s)
            PredictionApiKeyRegistrationName name = PredictionApiKeyRegistrationName.FromProjectLocationCatalogEventStorePredictionApiKeyRegistration("[PROJECT]", "[LOCATION]", "[CATALOG]", "[EVENT_STORE]", "[PREDICTION_API_KEY_REGISTRATION]");

            // Make the request
            predictionApiKeyRegistryClient.DeletePredictionApiKeyRegistration(name);
            // End snippet
        }
        public void DeletePredictionApiKeyRegistrationResourceNames()
        {
            moq::Mock <PredictionApiKeyRegistry.PredictionApiKeyRegistryClient> mockGrpcClient = new moq::Mock <PredictionApiKeyRegistry.PredictionApiKeyRegistryClient>(moq::MockBehavior.Strict);
            DeletePredictionApiKeyRegistrationRequest request = new DeletePredictionApiKeyRegistrationRequest
            {
                PredictionApiKeyRegistrationName = PredictionApiKeyRegistrationName.FromProjectLocationCatalogEventStorePredictionApiKeyRegistration("[PROJECT]", "[LOCATION]", "[CATALOG]", "[EVENT_STORE]", "[PREDICTION_API_KEY_REGISTRATION]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

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

            client.DeletePredictionApiKeyRegistration(request.PredictionApiKeyRegistrationName);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 3
0
        /// <summary>Snippet for DeletePredictionApiKeyRegistrationAsync</summary>
        public async Task DeletePredictionApiKeyRegistrationRequestObjectAsync()
        {
            // Snippet: DeletePredictionApiKeyRegistrationAsync(DeletePredictionApiKeyRegistrationRequest, CallSettings)
            // Additional: DeletePredictionApiKeyRegistrationAsync(DeletePredictionApiKeyRegistrationRequest, CancellationToken)
            // Create client
            PredictionApiKeyRegistryClient predictionApiKeyRegistryClient = await PredictionApiKeyRegistryClient.CreateAsync();

            // Initialize request argument(s)
            DeletePredictionApiKeyRegistrationRequest request = new DeletePredictionApiKeyRegistrationRequest
            {
                PredictionApiKeyRegistrationName = PredictionApiKeyRegistrationName.FromProjectLocationCatalogEventStorePredictionApiKeyRegistration("[PROJECT]", "[LOCATION]", "[CATALOG]", "[EVENT_STORE]", "[PREDICTION_API_KEY_REGISTRATION]"),
            };
            // Make the request
            await predictionApiKeyRegistryClient.DeletePredictionApiKeyRegistrationAsync(request);

            // End snippet
        }
        public async stt::Task DeletePredictionApiKeyRegistrationResourceNamesAsync()
        {
            moq::Mock <PredictionApiKeyRegistry.PredictionApiKeyRegistryClient> mockGrpcClient = new moq::Mock <PredictionApiKeyRegistry.PredictionApiKeyRegistryClient>(moq::MockBehavior.Strict);
            DeletePredictionApiKeyRegistrationRequest request = new DeletePredictionApiKeyRegistrationRequest
            {
                PredictionApiKeyRegistrationName = PredictionApiKeyRegistrationName.FromProjectLocationCatalogEventStorePredictionApiKeyRegistration("[PROJECT]", "[LOCATION]", "[CATALOG]", "[EVENT_STORE]", "[PREDICTION_API_KEY_REGISTRATION]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.DeletePredictionApiKeyRegistrationAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            PredictionApiKeyRegistryClient client = new PredictionApiKeyRegistryClientImpl(mockGrpcClient.Object, null);
            await client.DeletePredictionApiKeyRegistrationAsync(request.PredictionApiKeyRegistrationName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            await client.DeletePredictionApiKeyRegistrationAsync(request.PredictionApiKeyRegistrationName, st::CancellationToken.None);

            mockGrpcClient.VerifyAll();
        }
 /// <summary>
 /// Unregister an apiKey from using for predict method.
 /// </summary>
 /// <param name="name">
 /// Required. The API key to unregister including full resource path.
 /// "projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store/predictionApiKeyRegistrations/&amp;lt;YOUR_API_KEY&amp;gt;"
 /// </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 DeletePredictionApiKeyRegistrationAsync(PredictionApiKeyRegistrationName name, st::CancellationToken cancellationToken) =>
 DeletePredictionApiKeyRegistrationAsync(name, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
 /// <summary>
 /// Unregister an apiKey from using for predict method.
 /// </summary>
 /// <param name="name">
 /// Required. The API key to unregister including full resource path.
 /// "projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store/predictionApiKeyRegistrations/&amp;lt;YOUR_API_KEY&amp;gt;"
 /// </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 DeletePredictionApiKeyRegistrationAsync(PredictionApiKeyRegistrationName name, gaxgrpc::CallSettings callSettings = null) =>
 DeletePredictionApiKeyRegistrationAsync(new DeletePredictionApiKeyRegistrationRequest
 {
     PredictionApiKeyRegistrationName = gax::GaxPreconditions.CheckNotNull(name, nameof(name)),
 }, callSettings);