Пример #1
0
 /// <summary>Snippet for Get</summary>
 public void GetRequestObject()
 {
     // Snippet: Get(GetMachineTypeRequest, CallSettings)
     // Create client
     MachineTypesClient machineTypesClient = MachineTypesClient.Create();
     // Initialize request argument(s)
     GetMachineTypeRequest request = new GetMachineTypeRequest
     {
         Zone        = "",
         Project     = "",
         MachineType = "",
     };
     // Make the request
     MachineType response = machineTypesClient.Get(request);
     // End snippet
 }
Пример #2
0
        /// <summary>Snippet for GetAsync</summary>
        public async Task GetRequestObjectAsync()
        {
            // Snippet: GetAsync(GetMachineTypeRequest, CallSettings)
            // Additional: GetAsync(GetMachineTypeRequest, CancellationToken)
            // Create client
            MachineTypesClient machineTypesClient = await MachineTypesClient.CreateAsync();

            // Initialize request argument(s)
            GetMachineTypeRequest request = new GetMachineTypeRequest
            {
                Zone        = "",
                Project     = "",
                MachineType = "",
            };
            // Make the request
            MachineType response = await machineTypesClient.GetAsync(request);

            // End snippet
        }
Пример #3
0
        public async stt::Task GetAsync()
        {
            moq::Mock <MachineTypes.MachineTypesClient> mockGrpcClient = new moq::Mock <MachineTypes.MachineTypesClient>(moq::MockBehavior.Strict);
            GetMachineTypeRequest request = new GetMachineTypeRequest
            {
                Zone        = "zone255f4ea8",
                Project     = "projectaa6ff846",
                MachineType = "machine_type68ce40fa",
            };
            MachineType expectedResponse = new MachineType
            {
                Id                           = "id74b70bb8",
                Accelerators                 = { new Accelerators(), },
                Kind                         = "kindf7aa39d9",
                Name                         = "name1c9368b0",
                Zone                         = "zone255f4ea8",
                CreationTimestamp            = "creation_timestamp235e59a1",
                ImageSpaceGb                 = 480303298,
                MemoryMb                     = -1241574521,
                GuestCpus                    = 325324266,
                MaximumPersistentDisksSizeGb = "maximum_persistent_disks_size_gb3b744507",
                Description                  = "description2cf9da67",
                SelfLink                     = "self_link7e87f12d",
                ScratchDisks                 = { new ScratchDisks(), },
                MaximumPersistentDisks       = 774121303,
                Deprecated                   = new DeprecationStatus(),
                IsSharedCpu                  = true,
            };

            mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MachineType>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            MachineTypesClient client = new MachineTypesClientImpl(mockGrpcClient.Object, null);
            MachineType        responseCallSettings = await client.GetAsync(request.Project, request.Zone, request.MachineType, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            MachineType responseCancellationToken = await client.GetAsync(request.Project, request.Zone, request.MachineType, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void Get()
        {
            moq::Mock <MachineTypes.MachineTypesClient> mockGrpcClient = new moq::Mock <MachineTypes.MachineTypesClient>(moq::MockBehavior.Strict);
            GetMachineTypeRequest request = new GetMachineTypeRequest
            {
                Zone        = "zone255f4ea8",
                Project     = "projectaa6ff846",
                MachineType = "machine_type68ce40fa",
            };
            MachineType expectedResponse = new MachineType
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                Zone = "zone255f4ea8",
                CreationTimestamp            = "creation_timestamp235e59a1",
                ImageSpaceGb                 = 480303298,
                MemoryMb                     = -1241574521,
                MaximumPersistentDisksSizeGb = -4994613391596960505L,
                Accelerators                 = { new Accelerators(), },
                GuestCpus                    = 325324266,
                Description                  = "description2cf9da67",
                SelfLink                     = "self_link7e87f12d",
                ScratchDisks                 = { new ScratchDisks(), },
                MaximumPersistentDisks       = 774121303,
                Deprecated                   = new DeprecationStatus(),
                IsSharedCpu                  = true,
            };

            mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            MachineTypesClient client   = new MachineTypesClientImpl(mockGrpcClient.Object, null);
            MachineType        response = client.Get(request.Project, request.Zone, request.MachineType);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>
 /// Returns the specified machine type. Gets a list of available machine types 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 <MachineType> GetAsync(GetMachineTypeRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_GetMachineTypeRequest(ref request, ref callSettings);
     return(_callGet.Async(request, callSettings));
 }
 /// <summary>
 /// Returns the specified machine type. Gets a list of available machine types 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 MachineType Get(GetMachineTypeRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_GetMachineTypeRequest(ref request, ref callSettings);
     return(_callGet.Sync(request, callSettings));
 }
 partial void Modify_GetMachineTypeRequest(ref GetMachineTypeRequest request, ref gaxgrpc::CallSettings settings);
 /// <summary>
 /// Returns the specified machine type. Gets a list of available machine types 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 <MachineType> GetAsync(GetMachineTypeRequest request, st::CancellationToken cancellationToken) =>
 GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
 /// <summary>
 /// Returns the specified machine type. Gets a list of available machine types 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 <MachineType> GetAsync(GetMachineTypeRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();
 /// <summary>
 /// Returns the specified machine type. Gets a list of available machine types 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 virtual MachineType Get(GetMachineTypeRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();