/// <summary>Snippet for Get</summary> public void GetRequestObject() { // Snippet: Get(GetGlobalAddressRequest, CallSettings) // Create client GlobalAddressesClient globalAddressesClient = GlobalAddressesClient.Create(); // Initialize request argument(s) GetGlobalAddressRequest request = new GetGlobalAddressRequest { Project = "", Address = "", }; // Make the request Address response = globalAddressesClient.Get(request); // End snippet }
/// <summary>Snippet for GetAsync</summary> public async Task GetRequestObjectAsync() { // Snippet: GetAsync(GetGlobalAddressRequest, CallSettings) // Additional: GetAsync(GetGlobalAddressRequest, CancellationToken) // Create client GlobalAddressesClient globalAddressesClient = await GlobalAddressesClient.CreateAsync(); // Initialize request argument(s) GetGlobalAddressRequest request = new GetGlobalAddressRequest { Project = "", Address = "", }; // Make the request Address response = await globalAddressesClient.GetAsync(request); // End snippet }
public async stt::Task GetRequestObjectAsync() { moq::Mock <GlobalAddresses.GlobalAddressesClient> mockGrpcClient = new moq::Mock <GlobalAddresses.GlobalAddressesClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClientForGlobalOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetGlobalAddressRequest request = new GetGlobalAddressRequest { Project = "projectaa6ff846", Address = "address04984d88", }; Address expectedResponse = new Address { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", CreationTimestamp = "creation_timestamp235e59a1", Users = { "users2a5cc69b", }, Region = "regionedb20d96", Status = "status5444cb9a", Network = "networkd22ce091", AddressType = "address_type6c7d490a", IpVersion = "ip_versionde91b460", Subnetwork = "subnetworkf55bf572", Purpose = "purposebb6b064d", Description = "description2cf9da67", PrefixLength = -686118004, SelfLink = "self_link7e87f12d", Address_ = "address04984d88", NetworkTier = "network_tiere6fea951", }; mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Address>(stt::Task.FromResult(expectedResponse), null, null, null, null)); GlobalAddressesClient client = new GlobalAddressesClientImpl(mockGrpcClient.Object, null); Address responseCallSettings = await client.GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Address responseCancellationToken = await client.GetAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async stt::Task GetAsync() { moq::Mock <GlobalAddresses.GlobalAddressesClient> mockGrpcClient = new moq::Mock <GlobalAddresses.GlobalAddressesClient>(moq::MockBehavior.Strict); GetGlobalAddressRequest request = new GetGlobalAddressRequest { Project = "projectaa6ff846", Address = "address04984d88", }; Address expectedResponse = new Address { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", CreationTimestamp = "creation_timestamp235e59a1", Users = { "users2a5cc69b", }, Region = "regionedb20d96", Status = Address.Types.Status.Reserved, Network = "networkd22ce091", AddressType = Address.Types.AddressType.Internal, IpVersion = Address.Types.IpVersion.UndefinedIpVersion, Subnetwork = "subnetworkf55bf572", Purpose = Address.Types.Purpose.IpsecInterconnect, Description = "description2cf9da67", PrefixLength = -686118004, SelfLink = "self_link7e87f12d", Address_ = "address04984d88", NetworkTier = Address.Types.NetworkTier.Standard, }; mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Address>(stt::Task.FromResult(expectedResponse), null, null, null, null)); GlobalAddressesClient client = new GlobalAddressesClientImpl(mockGrpcClient.Object, null); Address responseCallSettings = await client.GetAsync(request.Project, request.Address, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Address responseCancellationToken = await client.GetAsync(request.Project, request.Address, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetRequestObject() { moq::Mock <GlobalAddresses.GlobalAddressesClient> mockGrpcClient = new moq::Mock <GlobalAddresses.GlobalAddressesClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClientForGlobalOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetGlobalAddressRequest request = new GetGlobalAddressRequest { Project = "projectaa6ff846", Address = "address04984d88", }; Address expectedResponse = new Address { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", CreationTimestamp = "creation_timestamp235e59a1", Users = { "users2a5cc69b", }, Region = "regionedb20d96", Status = Address.Types.Status.Reserved, Network = "networkd22ce091", AddressType = Address.Types.AddressType.Internal, IpVersion = Address.Types.IpVersion.UndefinedIpVersion, Subnetwork = "subnetworkf55bf572", Purpose = Address.Types.Purpose.IpsecInterconnect, Description = "description2cf9da67", PrefixLength = -686118004, SelfLink = "self_link7e87f12d", Address_ = "address04984d88", NetworkTier = Address.Types.NetworkTier.Standard, }; mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); GlobalAddressesClient client = new GlobalAddressesClientImpl(mockGrpcClient.Object, null); Address response = client.Get(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary> /// Returns the specified address resource. Gets a list of available addresses 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 <Address> GetAsync(GetGlobalAddressRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GetGlobalAddressRequest(ref request, ref callSettings); return(_callGet.Async(request, callSettings)); }
/// <summary> /// Returns the specified address resource. Gets a list of available addresses 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>The RPC response.</returns> public override Address Get(GetGlobalAddressRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GetGlobalAddressRequest(ref request, ref callSettings); return(_callGet.Sync(request, callSettings)); }
partial void Modify_GetGlobalAddressRequest(ref GetGlobalAddressRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Returns the specified address resource. Gets a list of available addresses 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 <Address> GetAsync(GetGlobalAddressRequest request, st::CancellationToken cancellationToken) => GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Returns the specified address resource. Gets a list of available addresses 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 <Address> GetAsync(GetGlobalAddressRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();