Ejemplo n.º 1
0
        /// <summary>
        /// Gets information about an Device Advisor endpoint.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the GetEndpoint service method.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        ///
        /// <returns>The response from the GetEndpoint service method, as returned by IoTDeviceAdvisor.</returns>
        /// <exception cref="Amazon.IoTDeviceAdvisor.Model.InternalServerException">
        /// Sends an Internal Failure exception.
        /// </exception>
        /// <exception cref="Amazon.IoTDeviceAdvisor.Model.ResourceNotFoundException">
        /// Sends a Resource Not Found exception.
        /// </exception>
        /// <exception cref="Amazon.IoTDeviceAdvisor.Model.ValidationException">
        /// Sends a validation exception.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/iotdeviceadvisor-2020-09-18/GetEndpoint">REST API Reference for GetEndpoint Operation</seealso>
        public virtual Task <GetEndpointResponse> GetEndpointAsync(GetEndpointRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = GetEndpointRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetEndpointResponseUnmarshaller.Instance;

            return(InvokeAsync <GetEndpointResponse>(request, options, cancellationToken));
        }
Ejemplo n.º 2
0
        internal virtual GetEndpointResponse GetEndpoint(GetEndpointRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = GetEndpointRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetEndpointResponseUnmarshaller.Instance;

            return(Invoke <GetEndpointResponse>(request, options));
        }
Ejemplo n.º 3
0
        public async stt::Task GetEndpointRequestObjectAsync()
        {
            moq::Mock <EndpointService.EndpointServiceClient> mockGrpcClient = new moq::Mock <EndpointService.EndpointServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetEndpointRequest request = new GetEndpointRequest
            {
                EndpointName = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]"),
            };
            Endpoint expectedResponse = new Endpoint
            {
                EndpointName   = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]"),
                DisplayName    = "display_name137f65c2",
                Description    = "description2cf9da67",
                DeployedModels =
                {
                    new DeployedModel(),
                },
                TrafficSplit =
                {
                    {
                        "key8a0b6e3c",
                        1623286560
                    },
                },
                Etag   = "etage8ad7218",
                Labels =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                CreateTime           = new wkt::Timestamp(),
                UpdateTime           = new wkt::Timestamp(),
                EncryptionSpec       = new EncryptionSpec(),
                NetworkAsNetworkName = NetworkName.FromProjectNetwork("[PROJECT]", "[NETWORK]"),
                ModelDeploymentMonitoringJobAsModelDeploymentMonitoringJobName = ModelDeploymentMonitoringJobName.FromProjectLocationModelDeploymentMonitoringJob("[PROJECT]", "[LOCATION]", "[MODEL_DEPLOYMENT_MONITORING_JOB]"),
                EnablePrivateServiceConnect = false,
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>Snippet for GetEndpoint</summary>
 public void GetEndpointRequestObject()
 {
     // Snippet: GetEndpoint(GetEndpointRequest, CallSettings)
     // Create client
     IDSClient iDSClient = IDSClient.Create();
     // Initialize request argument(s)
     GetEndpointRequest request = new GetEndpointRequest
     {
         EndpointName = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]"),
     };
     // Make the request
     Endpoint response = iDSClient.GetEndpoint(request);
     // End snippet
 }
        /// <summary>Snippet for GetEndpointAsync</summary>
        public async Task GetEndpointRequestObjectAsync()
        {
            // Snippet: GetEndpointAsync(GetEndpointRequest, CallSettings)
            // Additional: GetEndpointAsync(GetEndpointRequest, CancellationToken)
            // Create client
            IDSClient iDSClient = await IDSClient.CreateAsync();

            // Initialize request argument(s)
            GetEndpointRequest request = new GetEndpointRequest
            {
                EndpointName = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]"),
            };
            // Make the request
            Endpoint response = await iDSClient.GetEndpointAsync(request);

            // End snippet
        }
        public void GetEndpointRequestObject()
        {
            moq::Mock <EndpointService.EndpointServiceClient> mockGrpcClient = new moq::Mock <EndpointService.EndpointServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetEndpointRequest request = new GetEndpointRequest
            {
                EndpointName = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]"),
            };
            Endpoint expectedResponse = new Endpoint
            {
                EndpointName   = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]"),
                DisplayName    = "display_name137f65c2",
                Description    = "description2cf9da67",
                DeployedModels =
                {
                    new DeployedModel(),
                },
                TrafficSplit =
                {
                    {
                        "key8a0b6e3c",
                        1623286560
                    },
                },
                Etag   = "etage8ad7218",
                Labels =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                CreateTime     = new wkt::Timestamp(),
                UpdateTime     = new wkt::Timestamp(),
                EncryptionSpec = new EncryptionSpec(),
            };

            mockGrpcClient.Setup(x => x.GetEndpoint(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            EndpointServiceClient client = new EndpointServiceClientImpl(mockGrpcClient.Object, null);
            Endpoint response            = client.GetEndpoint(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        private void HandleOutput(GetEndpointRequest request)
        {
            var waiterConfig = new WaiterConfiguration
            {
                MaxAttempts           = MaxWaitAttempts,
                GetNextDelayInSeconds = (_) => WaitIntervalSeconds
            };

            switch (ParameterSetName)
            {
            case LifecycleStateParamSet:
                response = client.Waiters.ForEndpoint(request, waiterConfig, WaitForLifecycleState).Execute();
                break;

            case Default:
                response = client.GetEndpoint(request).GetAwaiter().GetResult();
                break;
            }
            WriteOutput(response, response.Endpoint);
        }
Ejemplo n.º 8
0
        public async stt::Task GetEndpointRequestObjectAsync()
        {
            moq::Mock <IDS.IDSClient> mockGrpcClient = new moq::Mock <IDS.IDSClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetEndpointRequest request = new GetEndpointRequest
            {
                EndpointName = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]"),
            };
            Endpoint expectedResponse = new Endpoint
            {
                EndpointName = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]"),
                CreateTime   = new wkt::Timestamp(),
                UpdateTime   = new wkt::Timestamp(),
                Labels       =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                Network = "networkd22ce091",
                EndpointForwardingRule = "endpoint_forwarding_ruleac397159",
                EndpointIp             = "endpoint_ip2239df0a",
                Description            = "description2cf9da67",
                Severity    = Endpoint.Types.Severity.Unspecified,
                State       = Endpoint.Types.State.Ready,
                TrafficLogs = true,
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            GetEndpointRequest request;

            try
            {
                request = new GetEndpointRequest
                {
                    EndpointId   = EndpointId,
                    RegistryId   = RegistryId,
                    OpcRequestId = OpcRequestId
                };

                HandleOutput(request);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }