/// <summary>Snippet for CreatePredictionApiKeyRegistration</summary> public void CreatePredictionApiKeyRegistration() { // Snippet: CreatePredictionApiKeyRegistration(string, PredictionApiKeyRegistration, CallSettings) // Create client PredictionApiKeyRegistryClient predictionApiKeyRegistryClient = PredictionApiKeyRegistryClient.Create(); // Initialize request argument(s) string parent = "projects/[PROJECT]/locations/[LOCATION]/catalogs/[CATALOG]/eventStores/[EVENT_STORE]"; PredictionApiKeyRegistration predictionApiKeyRegistration = new PredictionApiKeyRegistration(); // Make the request PredictionApiKeyRegistration response = predictionApiKeyRegistryClient.CreatePredictionApiKeyRegistration(parent, predictionApiKeyRegistration); // End snippet }
/// <summary>Snippet for CreatePredictionApiKeyRegistration</summary> public void CreatePredictionApiKeyRegistrationResourceNames() { // Snippet: CreatePredictionApiKeyRegistration(EventStoreName, PredictionApiKeyRegistration, CallSettings) // Create client PredictionApiKeyRegistryClient predictionApiKeyRegistryClient = PredictionApiKeyRegistryClient.Create(); // Initialize request argument(s) EventStoreName parent = EventStoreName.FromProjectLocationCatalogEventStore("[PROJECT]", "[LOCATION]", "[CATALOG]", "[EVENT_STORE]"); PredictionApiKeyRegistration predictionApiKeyRegistration = new PredictionApiKeyRegistration(); // Make the request PredictionApiKeyRegistration response = predictionApiKeyRegistryClient.CreatePredictionApiKeyRegistration(parent, predictionApiKeyRegistration); // End snippet }
/// <summary>Snippet for CreatePredictionApiKeyRegistrationAsync</summary> public async Task CreatePredictionApiKeyRegistrationAsync() { // Snippet: CreatePredictionApiKeyRegistrationAsync(string, PredictionApiKeyRegistration, CallSettings) // Additional: CreatePredictionApiKeyRegistrationAsync(string, PredictionApiKeyRegistration, CancellationToken) // Create client PredictionApiKeyRegistryClient predictionApiKeyRegistryClient = await PredictionApiKeyRegistryClient.CreateAsync(); // Initialize request argument(s) string parent = "projects/[PROJECT]/locations/[LOCATION]/catalogs/[CATALOG]/eventStores/[EVENT_STORE]"; PredictionApiKeyRegistration predictionApiKeyRegistration = new PredictionApiKeyRegistration(); // Make the request PredictionApiKeyRegistration response = await predictionApiKeyRegistryClient.CreatePredictionApiKeyRegistrationAsync(parent, predictionApiKeyRegistration); // End snippet }
/// <summary>Snippet for CreatePredictionApiKeyRegistration</summary> public void CreatePredictionApiKeyRegistrationRequestObject() { // Snippet: CreatePredictionApiKeyRegistration(CreatePredictionApiKeyRegistrationRequest, CallSettings) // Create client PredictionApiKeyRegistryClient predictionApiKeyRegistryClient = PredictionApiKeyRegistryClient.Create(); // Initialize request argument(s) CreatePredictionApiKeyRegistrationRequest request = new CreatePredictionApiKeyRegistrationRequest { ParentAsEventStoreName = EventStoreName.FromProjectLocationCatalogEventStore("[PROJECT]", "[LOCATION]", "[CATALOG]", "[EVENT_STORE]"), PredictionApiKeyRegistration = new PredictionApiKeyRegistration(), }; // Make the request PredictionApiKeyRegistration response = predictionApiKeyRegistryClient.CreatePredictionApiKeyRegistration(request); // End snippet }
/// <summary>Snippet for CreatePredictionApiKeyRegistrationAsync</summary> public async Task CreatePredictionApiKeyRegistrationResourceNamesAsync() { // Snippet: CreatePredictionApiKeyRegistrationAsync(EventStoreName, PredictionApiKeyRegistration, CallSettings) // Additional: CreatePredictionApiKeyRegistrationAsync(EventStoreName, PredictionApiKeyRegistration, CancellationToken) // Create client PredictionApiKeyRegistryClient predictionApiKeyRegistryClient = await PredictionApiKeyRegistryClient.CreateAsync(); // Initialize request argument(s) EventStoreName parent = EventStoreName.FromProjectLocationCatalogEventStore("[PROJECT]", "[LOCATION]", "[CATALOG]", "[EVENT_STORE]"); PredictionApiKeyRegistration predictionApiKeyRegistration = new PredictionApiKeyRegistration(); // Make the request PredictionApiKeyRegistration response = await predictionApiKeyRegistryClient.CreatePredictionApiKeyRegistrationAsync(parent, predictionApiKeyRegistration); // End snippet }
public void CreatePredictionApiKeyRegistration() { moq::Mock <PredictionApiKeyRegistry.PredictionApiKeyRegistryClient> mockGrpcClient = new moq::Mock <PredictionApiKeyRegistry.PredictionApiKeyRegistryClient>(moq::MockBehavior.Strict); CreatePredictionApiKeyRegistrationRequest request = new CreatePredictionApiKeyRegistrationRequest { ParentAsEventStoreName = EventStoreName.FromProjectLocationCatalogEventStore("[PROJECT]", "[LOCATION]", "[CATALOG]", "[EVENT_STORE]"), PredictionApiKeyRegistration = new PredictionApiKeyRegistration(), }; PredictionApiKeyRegistration expectedResponse = new PredictionApiKeyRegistration { ApiKey = "api_key30288039", }; mockGrpcClient.Setup(x => x.CreatePredictionApiKeyRegistration(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); PredictionApiKeyRegistryClient client = new PredictionApiKeyRegistryClientImpl(mockGrpcClient.Object, null); PredictionApiKeyRegistration response = client.CreatePredictionApiKeyRegistration(request.Parent, request.PredictionApiKeyRegistration); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task CreatePredictionApiKeyRegistrationAsync() { moq::Mock <PredictionApiKeyRegistry.PredictionApiKeyRegistryClient> mockGrpcClient = new moq::Mock <PredictionApiKeyRegistry.PredictionApiKeyRegistryClient>(moq::MockBehavior.Strict); CreatePredictionApiKeyRegistrationRequest request = new CreatePredictionApiKeyRegistrationRequest { ParentAsEventStoreName = EventStoreName.FromProjectLocationCatalogEventStore("[PROJECT]", "[LOCATION]", "[CATALOG]", "[EVENT_STORE]"), PredictionApiKeyRegistration = new PredictionApiKeyRegistration(), }; PredictionApiKeyRegistration expectedResponse = new PredictionApiKeyRegistration { ApiKey = "api_key30288039", }; mockGrpcClient.Setup(x => x.CreatePredictionApiKeyRegistrationAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <PredictionApiKeyRegistration>(stt::Task.FromResult(expectedResponse), null, null, null, null)); PredictionApiKeyRegistryClient client = new PredictionApiKeyRegistryClientImpl(mockGrpcClient.Object, null); PredictionApiKeyRegistration responseCallSettings = await client.CreatePredictionApiKeyRegistrationAsync(request.Parent, request.PredictionApiKeyRegistration, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); PredictionApiKeyRegistration responseCancellationToken = await client.CreatePredictionApiKeyRegistrationAsync(request.Parent, request.PredictionApiKeyRegistration, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary> /// Register an API key for use with predict method. /// </summary> /// <param name="parent"> /// Required. The parent resource path. /// "projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store". /// </param> /// <param name="predictionApiKeyRegistration"> /// Required. The prediction API key registration. /// </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 <PredictionApiKeyRegistration> CreatePredictionApiKeyRegistrationAsync(EventStoreName parent, PredictionApiKeyRegistration predictionApiKeyRegistration, st::CancellationToken cancellationToken) => CreatePredictionApiKeyRegistrationAsync(parent, predictionApiKeyRegistration, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Register an API key for use with predict method. /// </summary> /// <param name="parent"> /// Required. The parent resource path. /// "projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store". /// </param> /// <param name="predictionApiKeyRegistration"> /// Required. The prediction API key registration. /// </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 <PredictionApiKeyRegistration> CreatePredictionApiKeyRegistrationAsync(EventStoreName parent, PredictionApiKeyRegistration predictionApiKeyRegistration, gaxgrpc::CallSettings callSettings = null) => CreatePredictionApiKeyRegistrationAsync(new CreatePredictionApiKeyRegistrationRequest { ParentAsEventStoreName = gax::GaxPreconditions.CheckNotNull(parent, nameof(parent)), PredictionApiKeyRegistration = gax::GaxPreconditions.CheckNotNull(predictionApiKeyRegistration, nameof(predictionApiKeyRegistration)), }, callSettings);
/// <summary> /// Register an API key for use with predict method. /// </summary> /// <param name="parent"> /// Required. The parent resource path. /// "projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store". /// </param> /// <param name="predictionApiKeyRegistration"> /// Required. The prediction API key registration. /// </param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public virtual PredictionApiKeyRegistration CreatePredictionApiKeyRegistration(string parent, PredictionApiKeyRegistration predictionApiKeyRegistration, gaxgrpc::CallSettings callSettings = null) => CreatePredictionApiKeyRegistration(new CreatePredictionApiKeyRegistrationRequest { Parent = gax::GaxPreconditions.CheckNotNullOrEmpty(parent, nameof(parent)), PredictionApiKeyRegistration = gax::GaxPreconditions.CheckNotNull(predictionApiKeyRegistration, nameof(predictionApiKeyRegistration)), }, callSettings);