/// <summary>Snippet for DeleteSpecialistPoolAsync</summary>
        public async Task DeleteSpecialistPoolResourceNamesAsync()
        {
            // Snippet: DeleteSpecialistPoolAsync(SpecialistPoolName, CallSettings)
            // Additional: DeleteSpecialistPoolAsync(SpecialistPoolName, CancellationToken)
            // Create client
            SpecialistPoolServiceClient specialistPoolServiceClient = await SpecialistPoolServiceClient.CreateAsync();

            // Initialize request argument(s)
            SpecialistPoolName name = SpecialistPoolName.FromProjectLocationSpecialistPool("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]");
            // Make the request
            Operation <Empty, DeleteOperationMetadata> response = await specialistPoolServiceClient.DeleteSpecialistPoolAsync(name);

            // Poll until the returned long-running operation is complete
            Operation <Empty, DeleteOperationMetadata> 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, DeleteOperationMetadata> retrievedResponse = await specialistPoolServiceClient.PollOnceDeleteSpecialistPoolAsync(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
        }
Ejemplo n.º 2
0
        public void GetSpecialistPoolRequestObject()
        {
            moq::Mock <SpecialistPoolService.SpecialistPoolServiceClient> mockGrpcClient = new moq::Mock <SpecialistPoolService.SpecialistPoolServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetSpecialistPoolRequest request = new GetSpecialistPoolRequest
            {
                SpecialistPoolName = SpecialistPoolName.FromProjectLocationSpecialistPool("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]"),
            };
            SpecialistPool expectedResponse = new SpecialistPool
            {
                SpecialistPoolName      = SpecialistPoolName.FromProjectLocationSpecialistPool("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]"),
                DisplayName             = "display_name137f65c2",
                SpecialistManagersCount = 1389839351,
                SpecialistManagerEmails =
                {
                    "specialist_manager_emails54da434d",
                },
                PendingDataLabelingJobs =
                {
                    "pending_data_labeling_jobsd91cc38b",
                },
                SpecialistWorkerEmails =
                {
                    "specialist_worker_emailsac41cb4d",
                },
            };

            mockGrpcClient.Setup(x => x.GetSpecialistPool(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            SpecialistPoolServiceClient client = new SpecialistPoolServiceClientImpl(mockGrpcClient.Object, null);
            SpecialistPool response            = client.GetSpecialistPool(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>Snippet for DeleteSpecialistPool</summary>
        public void DeleteSpecialistPoolRequestObject()
        {
            // Snippet: DeleteSpecialistPool(DeleteSpecialistPoolRequest, CallSettings)
            // Create client
            SpecialistPoolServiceClient specialistPoolServiceClient = SpecialistPoolServiceClient.Create();
            // Initialize request argument(s)
            DeleteSpecialistPoolRequest request = new DeleteSpecialistPoolRequest
            {
                SpecialistPoolName = SpecialistPoolName.FromProjectLocationSpecialistPool("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]"),
                Force = false,
            };
            // Make the request
            Operation <Empty, DeleteOperationMetadata> response = specialistPoolServiceClient.DeleteSpecialistPool(request);

            // Poll until the returned long-running operation is complete
            Operation <Empty, DeleteOperationMetadata> 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, DeleteOperationMetadata> retrievedResponse = specialistPoolServiceClient.PollOnceDeleteSpecialistPool(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
        }
Ejemplo n.º 4
0
        public async stt::Task GetSpecialistPoolRequestObjectAsync()
        {
            moq::Mock <SpecialistPoolService.SpecialistPoolServiceClient> mockGrpcClient = new moq::Mock <SpecialistPoolService.SpecialistPoolServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetSpecialistPoolRequest request = new GetSpecialistPoolRequest
            {
                SpecialistPoolName = SpecialistPoolName.FromProjectLocationSpecialistPool("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]"),
            };
            SpecialistPool expectedResponse = new SpecialistPool
            {
                SpecialistPoolName      = SpecialistPoolName.FromProjectLocationSpecialistPool("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]"),
                DisplayName             = "display_name137f65c2",
                SpecialistManagersCount = 1389839351,
                SpecialistManagerEmails =
                {
                    "specialist_manager_emails54da434d",
                },
                PendingDataLabelingJobs =
                {
                    "pending_data_labeling_jobsd91cc38b",
                },
            };

            mockGrpcClient.Setup(x => x.GetSpecialistPoolAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <SpecialistPool>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            SpecialistPoolServiceClient client  = new SpecialistPoolServiceClientImpl(mockGrpcClient.Object, null);
            SpecialistPool responseCallSettings = await client.GetSpecialistPoolAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            SpecialistPool responseCancellationToken = await client.GetSpecialistPoolAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>Snippet for GetSpecialistPool</summary>
 public void GetSpecialistPoolResourceNames()
 {
     // Snippet: GetSpecialistPool(SpecialistPoolName, CallSettings)
     // Create client
     SpecialistPoolServiceClient specialistPoolServiceClient = SpecialistPoolServiceClient.Create();
     // Initialize request argument(s)
     SpecialistPoolName name = SpecialistPoolName.FromProjectLocationSpecialistPool("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]");
     // Make the request
     SpecialistPool response = specialistPoolServiceClient.GetSpecialistPool(name);
     // End snippet
 }
        /// <summary>Snippet for GetSpecialistPoolAsync</summary>
        public async Task GetSpecialistPoolResourceNamesAsync()
        {
            // Snippet: GetSpecialistPoolAsync(SpecialistPoolName, CallSettings)
            // Additional: GetSpecialistPoolAsync(SpecialistPoolName, CancellationToken)
            // Create client
            SpecialistPoolServiceClient specialistPoolServiceClient = await SpecialistPoolServiceClient.CreateAsync();

            // Initialize request argument(s)
            SpecialistPoolName name = SpecialistPoolName.FromProjectLocationSpecialistPool("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]");
            // Make the request
            SpecialistPool response = await specialistPoolServiceClient.GetSpecialistPoolAsync(name);

            // End snippet
        }
 /// <summary>Snippet for GetSpecialistPool</summary>
 public void GetSpecialistPoolRequestObject()
 {
     // Snippet: GetSpecialistPool(GetSpecialistPoolRequest, CallSettings)
     // Create client
     SpecialistPoolServiceClient specialistPoolServiceClient = SpecialistPoolServiceClient.Create();
     // Initialize request argument(s)
     GetSpecialistPoolRequest request = new GetSpecialistPoolRequest
     {
         SpecialistPoolName = SpecialistPoolName.FromProjectLocationSpecialistPool("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]"),
     };
     // Make the request
     SpecialistPool response = specialistPoolServiceClient.GetSpecialistPool(request);
     // End snippet
 }