public void GetRequestObject()
        {
            moq::Mock <ResourcePolicies.ResourcePoliciesClient> mockGrpcClient = new moq::Mock <ResourcePolicies.ResourcePoliciesClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForRegionOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetResourcePolicyRequest request = new GetResourcePolicyRequest
            {
                Region         = "regionedb20d96",
                ResourcePolicy = "resource_policydde7e557",
                Project        = "projectaa6ff846",
            };
            ResourcePolicy expectedResponse = new ResourcePolicy
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                GroupPlacementPolicy = new ResourcePolicyGroupPlacementPolicy(),
                CreationTimestamp    = "creation_timestamp235e59a1",
                Region = "regionedb20d96",
                Status = "status5444cb9a",
                SnapshotSchedulePolicy = new ResourcePolicySnapshotSchedulePolicy(),
                ResourceStatus         = new ResourcePolicyResourceStatus(),
                InstanceSchedulePolicy = new ResourcePolicyInstanceSchedulePolicy(),
                Description            = "description2cf9da67",
                SelfLink = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ResourcePoliciesClient client   = new ResourcePoliciesClientImpl(mockGrpcClient.Object, null);
            ResourcePolicy         response = client.Get(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 2
0
        internal virtual GetResourcePolicyResponse GetResourcePolicy(GetResourcePolicyRequest request)
        {
            var marshaller   = GetResourcePolicyRequestMarshaller.Instance;
            var unmarshaller = GetResourcePolicyResponseUnmarshaller.Instance;

            return(Invoke <GetResourcePolicyRequest, GetResourcePolicyResponse>(request, marshaller, unmarshaller));
        }
        public async stt::Task GetAsync()
        {
            moq::Mock <ResourcePolicies.ResourcePoliciesClient> mockGrpcClient = new moq::Mock <ResourcePolicies.ResourcePoliciesClient>(moq::MockBehavior.Strict);
            GetResourcePolicyRequest request = new GetResourcePolicyRequest
            {
                Region         = "regionedb20d96",
                ResourcePolicy = "resource_policydde7e557",
                Project        = "projectaa6ff846",
            };
            ResourcePolicy expectedResponse = new ResourcePolicy
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                GroupPlacementPolicy = new ResourcePolicyGroupPlacementPolicy(),
                CreationTimestamp    = "creation_timestamp235e59a1",
                Region = "regionedb20d96",
                Status = ResourcePolicy.Types.Status.Deleting,
                SnapshotSchedulePolicy = new ResourcePolicySnapshotSchedulePolicy(),
                ResourceStatus         = new ResourcePolicyResourceStatus(),
                InstanceSchedulePolicy = new ResourcePolicyInstanceSchedulePolicy(),
                Description            = "description2cf9da67",
                SelfLink = "self_link7e87f12d",
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetResourcePolicy operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetResourcePolicy operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/GetResourcePolicy">REST API Reference for GetResourcePolicy Operation</seealso>
        public virtual Task <GetResourcePolicyResponse> GetResourcePolicyAsync(GetResourcePolicyRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = GetResourcePolicyRequestMarshaller.Instance;
            var unmarshaller = GetResourcePolicyResponseUnmarshaller.Instance;

            return(InvokeAsync <GetResourcePolicyRequest, GetResourcePolicyResponse>(request, marshaller,
                                                                                     unmarshaller, cancellationToken));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetResourcePolicy operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetResourcePolicy operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/GetResourcePolicy">REST API Reference for GetResourcePolicy Operation</seealso>
        public virtual Task <GetResourcePolicyResponse> GetResourcePolicyAsync(GetResourcePolicyRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = GetResourcePolicyRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetResourcePolicyResponseUnmarshaller.Instance;

            return(InvokeAsync <GetResourcePolicyResponse>(request, options, cancellationToken));
        }
Exemplo n.º 6
0
        internal virtual GetResourcePolicyResponse GetResourcePolicy(GetResourcePolicyRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = GetResourcePolicyRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetResourcePolicyResponseUnmarshaller.Instance;

            return(Invoke <GetResourcePolicyResponse>(request, options));
        }
Exemplo n.º 7
0
 /// <summary>Snippet for Get</summary>
 public void GetRequestObject()
 {
     // Snippet: Get(GetResourcePolicyRequest, CallSettings)
     // Create client
     ResourcePoliciesClient resourcePoliciesClient = ResourcePoliciesClient.Create();
     // Initialize request argument(s)
     GetResourcePolicyRequest request = new GetResourcePolicyRequest
     {
         Region         = "",
         ResourcePolicy = "",
         Project        = "",
     };
     // Make the request
     ResourcePolicy response = resourcePoliciesClient.Get(request);
     // End snippet
 }
Exemplo n.º 8
0
        /// <summary>Snippet for GetAsync</summary>
        public async Task GetRequestObjectAsync()
        {
            // Snippet: GetAsync(GetResourcePolicyRequest, CallSettings)
            // Additional: GetAsync(GetResourcePolicyRequest, CancellationToken)
            // Create client
            ResourcePoliciesClient resourcePoliciesClient = await ResourcePoliciesClient.CreateAsync();

            // Initialize request argument(s)
            GetResourcePolicyRequest request = new GetResourcePolicyRequest
            {
                Region         = "",
                ResourcePolicy = "",
                Project        = "",
            };
            // Make the request
            ResourcePolicy response = await resourcePoliciesClient.GetAsync(request);

            // End snippet
        }