public void EndpointType()
        {
            DescribeEndpointRequest instance = new DescribeEndpointRequest();
            string EndpointType = "EndpointType";

            instance.EndpointType = EndpointType;
            Assert.Equal(EndpointType, instance.EndpointType);
        }
        public void LocationProduct()
        {
            DescribeEndpointRequest instance = new DescribeEndpointRequest();
            string LocationProduct           = "LocationProduct";

            instance.LocationProduct = LocationProduct;
            Assert.Equal(LocationProduct, instance.LocationProduct);
        }
        public void Id()
        {
            DescribeEndpointRequest instance = new DescribeEndpointRequest();
            string Id = "Id";

            instance.Id = Id;
            Assert.Equal(Id, instance.Id);
        }
        public DescribeEndpointResponse DescribeEndpoint(String regionId, String locationProduct,
                                                         Credential credential, LocationConfig locationConfig, String locationEndpointType)
        {
            if (isEmpty(locationProduct))
            {
                return(null);
            }

            DescribeEndpointRequest request = new DescribeEndpointRequest();

            request.AcceptFormat    = FormatType.JSON;
            request.Id              = regionId;
            request.RegionId        = locationConfig.RegionId;
            request.LocationProduct = locationProduct;
            if (isEmpty(locationEndpointType))
            {
                request.EndpointType = DEFAULT_ENDPOINT_TYPE;
            }
            else
            {
                request.EndpointType = locationEndpointType;
            }


            ProductDomain domain = new ProductDomain(locationConfig.Product, locationConfig.Endpoint);

            try
            {
                HttpRequest  httpRequest  = request.SignRequest(signer, credential, FormatType.JSON, domain);
                HttpResponse httpResponse = HttpResponse.GetResponse(httpRequest);
                if (httpResponse.isSuccess())
                {
                    String data = System.Text.Encoding.UTF8.GetString(httpResponse.Content);
                    DescribeEndpointResponse response = getEndpointResponse(data, request.EndpointType);
                    if (null == response || isEmpty(response.Endpoint))
                    {
                        return(null);
                    }
                    return(response);
                }
                AcsError error = readError(httpResponse, FormatType.JSON);
                if (500 <= httpResponse.Status)
                {
                    Console.WriteLine("Invoke_Error, requestId: " + error.RequestId + "; code: " + error.ErrorCode
                                      + "; Msg: " + error.ErrorMessage);
                    return(null);
                }
                Console.WriteLine("Invoke_Error, requestId: " + error.RequestId + "; code: " + error.ErrorCode
                                  + "; Msg: " + error.ErrorMessage);
                return(null);
            }
            catch (Exception e)
            {
                Console.WriteLine("Invoke Remote Error,Msg" + e.Message);
                return(null);
            }
        }
Beispiel #5
0
        public async Task <DescribeEndpointResponse> DescribeEndpointAsync(String regionId, String locationProduct,
                                                                           Credential credential, LocationConfig locationConfig)
        {
            if (IsEmpty(locationProduct))
            {
                return(null);
            }

            var request = new DescribeEndpointRequest
            {
                AcceptFormat    = FormatType.JSON,
                Id              = regionId,
                RegionId        = locationConfig.RegionId,
                LocationProduct = locationProduct,
                EndpointType    = DEFAULT_ENDPOINT_TYPE
            };

            var domain = new ProductDomain(locationConfig.Product, locationConfig.Endpoint);

            try
            {
                var httpRequest  = request.SignRequest(signer, credential, FormatType.JSON, domain);
                var httpResponse = await HttpResponse.GetResponseAsync(httpRequest);

                if (httpResponse.IsSuccess())
                {
                    var data = Encoding.UTF8.GetString(httpResponse.Content);
                    DescribeEndpointResponse response = GetEndpointResponse(data, DEFAULT_ENDPOINT_TYPE);
                    if (null == response || IsEmpty(response.Endpoint))
                    {
                        return(null);
                    }

                    return(response);
                }

                var error = ReadError(httpResponse, FormatType.JSON);
                if (500 <= httpResponse.Status)
                {
                    Console.WriteLine("Invoke_Error, requestId:" + error.RequestId + "; code:" + error.ErrorCode
                                      + "; Msg" + error.ErrorMessage);
                    return(null);
                }

                Console.WriteLine("Invoke_Error, requestId:" + error.RequestId + "; code:" + error.ErrorCode
                                  + "; Msg" + error.ErrorMessage);

                return(null);
            }
            catch (Exception e)
            {
                Console.WriteLine("Invoke Remote Error,Msg" + e.Message);
                return(null);
            }
        }
Beispiel #6
0
        public async Task <DescribeEndpointResponse> DescribeEndpointAsync(string regionId, string serviceCode, string endpointType,
                                                                           Credential credential, LocationConfig locationConfig,
                                                                           CancellationToken cancellationToken = default(CancellationToken))
        {
            if (string.IsNullOrEmpty(serviceCode))
            {
                return(null);
            }

            if (string.IsNullOrEmpty(endpointType))
            {
                endpointType = DEFAULT_ENDPOINT_TYPE;
            }

            var request = new DescribeEndpointRequest
            {
                AcceptFormat    = FormatType.JSON,
                Id              = regionId,
                RegionId        = locationConfig.RegionId,
                LocationProduct = serviceCode,
                SecurityToken   = credential.SecurityToken,
                EndpointType    = endpointType
            };

            var signer = Signer.GetSigner(new LegacyCredentials(credential));
            var domain = new ProductDomain(locationConfig.Product, locationConfig.Endpoint);

            var httpRequest = request.SignRequest(signer, credential, FormatType.JSON, domain);

            httpRequest.SetConnectTimeoutInMilliSeconds(100000);
            httpRequest.SetReadTimeoutInMilliSeconds(100000);
            var httpResponse = await GetResponseAsync(httpRequest, cancellationToken).ConfigureAwait(false);

            if (httpResponse.isSuccess())
            {
                var data     = Encoding.UTF8.GetString(httpResponse.Content);
                var response = GetEndpointResponse(data, endpointType);
                if (response == null || string.IsNullOrEmpty(response.Endpoint))
                {
                    return(null);
                }

                return(response);
            }

            var error = ReadError(httpResponse, FormatType.JSON);

            if (500 <= httpResponse.Status)
            {
                return(null);
            }

            return(null);
        }
        private static ProductDomain GetProductDomainByLocation(String regionId,
                                                                String product, IAcsClient acsClient)
        {
            DescribeEndpointRequest describeEndpointRequest = new DescribeEndpointRequest();

            describeEndpointRequest.RegionId = regionId;
            describeEndpointRequest.SetService(product.ToLower());
            //DescribeEndpointResponse describeEndpointResponse = acsClient.getAcsResponse(describeEndpointRequest);
            //ProductDomain productDomain = new ProductDomain(product, describeEndpointResponse.Endpoint);
            //return productDomain;
            return(null);
        }
Beispiel #8
0
        public DescribeEndpointResponse DescribeEndpoint(string regionId, string serviceCode, string endpointType,
                                                         Credential credential, LocationConfig locationConfig)
        {
            if (string.IsNullOrEmpty(serviceCode))
            {
                return(null);
            }

            if (string.IsNullOrEmpty(endpointType))
            {
                endpointType = DEFAULT_ENDPOINT_TYPE;
            }

            var request = new DescribeEndpointRequest
            {
                AcceptFormat    = FormatType.JSON,
                Id              = regionId,
                RegionId        = locationConfig.RegionId,
                LocationProduct = serviceCode,
                SecurityToken   = credential.SecurityToken,
                EndpointType    = endpointType
            };

            var signer = Signer.GetSigner(new LegacyCredentials(credential));
            var domain = new ProductDomain(locationConfig.Product, locationConfig.Endpoint);

            var httpRequest  = request.SignRequest(signer, credential, FormatType.JSON, domain);
            var httpResponse = GetResponse(httpRequest);

            if (httpResponse.isSuccess())
            {
                var data     = Encoding.UTF8.GetString(httpResponse.Content);
                var response = GetEndpointResponse(data, endpointType);
                if (response == null || string.IsNullOrEmpty(response.Endpoint))
                {
                    return(null);
                }

                return(response);
            }

            var error = ReadError(httpResponse, FormatType.JSON);

            if (500 <= httpResponse.Status)
            {
                return(null);
            }

            return(null);
        }
        public void GetResponse()
        {
            var instance            = new DescribeEndpointRequest();
            var unmarshallerContext = new UnmarshallerContext();

            if (unmarshallerContext.ResponseDictionary == null)
            {
                unmarshallerContext.ResponseDictionary = new Dictionary <string, string>
                {
                    { "foo", "bar" },
                    { "a", "A" },
                    { "b", "B" }
                };
            }

            var result = instance.GetResponse(unmarshallerContext);

            Assert.Null(result);
        }
Beispiel #10
0
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeEndpoint operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DescribeEndpoint 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>
        public Task<DescribeEndpointResponse> DescribeEndpointAsync(DescribeEndpointRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DescribeEndpointRequestMarshaller();
            var unmarshaller = DescribeEndpointResponseUnmarshaller.Instance;

            return InvokeAsync<DescribeEndpointRequest,DescribeEndpointResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
Beispiel #11
0
 /// <summary>
 /// Returns a unique endpoint specific to the AWS account making the call. You specify
 /// the following URI when updating state information for your thing: https://<i>endpoint</i>/things/<i>thingName</i>/shadow.
 /// </summary>
 /// <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 DescribeEndpoint service method, as returned by IoT.</returns>
 /// <exception cref="Amazon.IoT.Model.InternalFailureException">
 /// An unexpected error has occurred.
 /// </exception>
 /// <exception cref="Amazon.IoT.Model.ThrottlingException">
 /// The rate exceeds the limit.
 /// </exception>
 /// <exception cref="Amazon.IoT.Model.UnauthorizedException">
 /// You are not authorized to perform this operation.
 /// </exception>
 public Task<DescribeEndpointResponse> DescribeEndpointAsync(System.Threading.CancellationToken cancellationToken = default(CancellationToken))
 {
     var request = new DescribeEndpointRequest();
     return DescribeEndpointAsync(request, cancellationToken);
 }
Beispiel #12
0
        /// <summary>
        /// Returns a unique endpoint specific to the AWS account making the call. You specify
        /// the following URI when updating state information for your thing: https://<i>endpoint</i>/things/<i>thingName</i>/shadow.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the DescribeEndpoint service method.</param>
        /// 
        /// <returns>The response from the DescribeEndpoint service method, as returned by IoT.</returns>
        /// <exception cref="Amazon.IoT.Model.InternalFailureException">
        /// An unexpected error has occurred.
        /// </exception>
        /// <exception cref="Amazon.IoT.Model.ThrottlingException">
        /// The rate exceeds the limit.
        /// </exception>
        /// <exception cref="Amazon.IoT.Model.UnauthorizedException">
        /// You are not authorized to perform this operation.
        /// </exception>
        public DescribeEndpointResponse DescribeEndpoint(DescribeEndpointRequest request)
        {
            var marshaller = new DescribeEndpointRequestMarshaller();
            var unmarshaller = DescribeEndpointResponseUnmarshaller.Instance;

            return Invoke<DescribeEndpointRequest,DescribeEndpointResponse>(request, marshaller, unmarshaller);
        }
Beispiel #13
0
 /// <summary>
 /// Returns a unique endpoint specific to the AWS account making the call. You specify
 /// the following URI when updating state information for your thing: https://<i>endpoint</i>/things/<i>thingName</i>/shadow.
 /// </summary>
 /// 
 /// <returns>The response from the DescribeEndpoint service method, as returned by IoT.</returns>
 /// <exception cref="Amazon.IoT.Model.InternalFailureException">
 /// An unexpected error has occurred.
 /// </exception>
 /// <exception cref="Amazon.IoT.Model.ThrottlingException">
 /// The rate exceeds the limit.
 /// </exception>
 /// <exception cref="Amazon.IoT.Model.UnauthorizedException">
 /// You are not authorized to perform this operation.
 /// </exception>
 public DescribeEndpointResponse DescribeEndpoint()
 {
     var request = new DescribeEndpointRequest();
     return DescribeEndpoint(request);
 }
Beispiel #14
0
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeEndpoint operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DescribeEndpoint operation on AmazonIoTClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeEndpoint
        ///         operation.</returns>
        public IAsyncResult BeginDescribeEndpoint(DescribeEndpointRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new DescribeEndpointRequestMarshaller();
            var unmarshaller = DescribeEndpointResponseUnmarshaller.Instance;

            return BeginInvoke<DescribeEndpointRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
 private static ProductDomain GetProductDomainByLocation(String regionId,
         String product, IAcsClient acsClient)
 {
     DescribeEndpointRequest describeEndpointRequest = new DescribeEndpointRequest();
     describeEndpointRequest.RegionId = regionId;
     describeEndpointRequest.SetService(product.ToLower());
     //DescribeEndpointResponse describeEndpointResponse = acsClient.getAcsResponse(describeEndpointRequest);
     //ProductDomain productDomain = new ProductDomain(product, describeEndpointResponse.Endpoint);
     //return productDomain;
     return null;
 }