/// <summary>Snippet for Get</summary> public void GetRequestObject() { // Snippet: Get(GetGlobalOrganizationOperationRequest, CallSettings) // Create client GlobalOrganizationOperationsClient globalOrganizationOperationsClient = GlobalOrganizationOperationsClient.Create(); // Initialize request argument(s) GetGlobalOrganizationOperationRequest request = new GetGlobalOrganizationOperationRequest { Operation = "", ParentId = "", }; // Make the request Operation response = globalOrganizationOperationsClient.Get(request); // End snippet }
public async stt::Task GetRequestObjectAsync() { moq::Mock <GlobalOrganizationOperations.GlobalOrganizationOperationsClient> mockGrpcClient = new moq::Mock <GlobalOrganizationOperations.GlobalOrganizationOperationsClient>(moq::MockBehavior.Strict); GetGlobalOrganizationOperationRequest request = new GetGlobalOrganizationOperationRequest { Operation = "operation615a23f7", ParentId = "parent_id8279e36b", }; Operation expectedResponse = new Operation { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", User = "******", Zone = "zone255f4ea8", CreationTimestamp = "creation_timestamp235e59a1", StartTime = "start_timebd8dd9c4", OperationGroupId = "operation_group_idd2040cf0", TargetLink = "target_link9b435dc0", Progress = 278622268, Error = new Error(), EndTime = "end_time89285d30", Region = "regionedb20d96", OperationType = "operation_typeece9e153", Status = Operation.Types.Status.Pending, HttpErrorMessage = "http_error_messageb5ef3c7f", TargetId = 6263187990225347157UL, ClientOperationId = "client_operation_id4e51b631", StatusMessage = "status_message2c618f86", HttpErrorStatusCode = 1766362655, Description = "description2cf9da67", InsertTime = "insert_time7467185a", SelfLink = "self_link7e87f12d", Warnings = { new Warnings(), }, }; mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Operation>(stt::Task.FromResult(expectedResponse), null, null, null, null)); GlobalOrganizationOperationsClient client = new GlobalOrganizationOperationsClientImpl(mockGrpcClient.Object, null); Operation responseCallSettings = await client.GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Operation responseCancellationToken = await client.GetAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetAsync</summary> public async Task GetRequestObjectAsync() { // Snippet: GetAsync(GetGlobalOrganizationOperationRequest, CallSettings) // Additional: GetAsync(GetGlobalOrganizationOperationRequest, CancellationToken) // Create client GlobalOrganizationOperationsClient globalOrganizationOperationsClient = await GlobalOrganizationOperationsClient.CreateAsync(); // Initialize request argument(s) GetGlobalOrganizationOperationRequest request = new GetGlobalOrganizationOperationRequest { Operation = "", ParentId = "", }; // Make the request Operation response = await globalOrganizationOperationsClient.GetAsync(request); // End snippet }
public void GetRequestObject() { moq::Mock <GlobalOrganizationOperations.GlobalOrganizationOperationsClient> mockGrpcClient = new moq::Mock <GlobalOrganizationOperations.GlobalOrganizationOperationsClient>(moq::MockBehavior.Strict); GetGlobalOrganizationOperationRequest request = new GetGlobalOrganizationOperationRequest { Operation = "operation615a23f7", ParentId = "parent_id8279e36b", }; Operation expectedResponse = new Operation { Id = "id74b70bb8", Kind = "kindf7aa39d9", Name = "name1c9368b0", User = "******", Zone = "zone255f4ea8", CreationTimestamp = "creation_timestamp235e59a1", StartTime = "start_timebd8dd9c4", OperationGroupId = "operation_group_idd2040cf0", TargetLink = "target_link9b435dc0", Progress = 278622268, Error = new Error(), EndTime = "end_time89285d30", Region = "regionedb20d96", OperationType = "operation_typeece9e153", Status = Operation.Types.Status.Pending, HttpErrorMessage = "http_error_messageb5ef3c7f", TargetId = "target_id16dfe255", ClientOperationId = "client_operation_id4e51b631", StatusMessage = "status_message2c618f86", HttpErrorStatusCode = 1766362655, Description = "description2cf9da67", InsertTime = "insert_time7467185a", SelfLink = "self_link7e87f12d", Warnings = { new Warnings(), }, }; mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); GlobalOrganizationOperationsClient client = new GlobalOrganizationOperationsClientImpl(mockGrpcClient.Object, null); Operation response = client.Get(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary> /// Retrieves the specified Operations resource. Gets a list of operations by making a `list()` request. /// </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 <Operation> GetAsync(GetGlobalOrganizationOperationRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GetGlobalOrganizationOperationRequest(ref request, ref callSettings); return(_callGet.Async(request, callSettings)); }
partial void Modify_GetGlobalOrganizationOperationRequest(ref GetGlobalOrganizationOperationRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Retrieves the specified Operations resource. Gets a list of operations by making a `list()` request. /// </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 <Operation> GetAsync(GetGlobalOrganizationOperationRequest request, st::CancellationToken cancellationToken) => GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Retrieves the specified Operations resource. Gets a list of operations by making a `list()` request. /// </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 <Operation> GetAsync(GetGlobalOrganizationOperationRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();