Esempio n. 1
0
        public void CreateCertificateFromCsrMarshallTest()
        {
            var operation = service_model.FindOperation("CreateCertificateFromCsr");

            var request    = InstantiateClassGenerator.Execute <CreateCertificateFromCsrRequest>();
            var marshaller = new CreateCertificateFromCsrRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);

            RequestValidator.Validate("CreateCertificateFromCsr", request, internalRequest, service_model);

            var webResponse = new WebResponseData
            {
                Headers =
                {
                    { "x-amzn-RequestId", Guid.NewGuid().ToString() },
                    { "x-amz-crc32",      "0"                       }
                }
            };

            var payloadResponse = new JsonSampleGenerator(service_model, operation.ResponseStructure).Execute();

            webResponse.Headers.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(payloadResponse).Length.ToString());
            var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(payloadResponse), false, webResponse);
            ResponseUnmarshaller unmarshaller = CreateCertificateFromCsrResponseUnmarshaller.Instance;
            var response = unmarshaller.Unmarshall(context)
                           as CreateCertificateFromCsrResponse;

            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
Esempio n. 2
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateCertificateFromCsr operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateCertificateFromCsr 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<CreateCertificateFromCsrResponse> CreateCertificateFromCsrAsync(CreateCertificateFromCsrRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateCertificateFromCsrRequestMarshaller();
            var unmarshaller = CreateCertificateFromCsrResponseUnmarshaller.Instance;

            return InvokeAsync<CreateCertificateFromCsrRequest,CreateCertificateFromCsrResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
Esempio n. 3
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateCertificateFromCsr operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateCertificateFromCsr 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 EndCreateCertificateFromCsr
        ///         operation.</returns>
        public IAsyncResult BeginCreateCertificateFromCsr(CreateCertificateFromCsrRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new CreateCertificateFromCsrRequestMarshaller();
            var unmarshaller = CreateCertificateFromCsrResponseUnmarshaller.Instance;

            return BeginInvoke<CreateCertificateFromCsrRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
Esempio n. 4
0
        /// <summary>
        /// Creates an X.509 certificate using the specified certificate signing request.
        /// 
        ///  
        /// <para>
        /// <b>Note</b> Reusing the same certificate signing request (CSR) results in a distinct
        /// certificate.
        /// </para>
        ///  
        /// <para>
        /// You can create multiple certificates in a batch by creating a directory and copying
        /// multiple .csr files into that directory and specifying that directory on the command
        /// line. The following commands show how to create a batch of certificates given a batch
        /// of CSRs. 
        /// </para>
        ///  
        /// <para>
        /// Assuming a set of CSRs are located inside of the directory my-csr-directory:
        /// </para>
        /// &gt; 
        /// <para>
        /// On Linux and OSX, the command is:
        /// </para>
        ///  
        /// <para>
        /// $ ls my-csr-directory/ | xargs -I {} aws iot create-certificate-from-csr --certificate-signing-request
        /// file://my-csr-directory/{}
        /// </para>
        ///  
        /// <para>
        ///  This command lists all of the CSRs in my-csr-directory and pipes each CSR filename
        /// to the aws iot create-certificate-from-csr AWS CLI command to create a certificate
        /// for the corresponding CSR. 
        /// </para>
        ///  
        /// <para>
        ///  The aws iot create-certificate-from-csr part of the command can also be run in parallel
        /// to speed up the certificate creation process: 
        /// </para>
        ///  
        /// <para>
        ///  $ ls my-csr-directory/ | xargs -P 10 -I {} aws iot create-certificate-from-csr --certificate-signing-request
        /// file://my-csr-directory/{} 
        /// </para>
        ///  
        /// <para>
        ///  On Windows PowerShell, the command to create certificates for all CSRs in my-csr-directory
        /// is: 
        /// </para>
        ///  
        /// <para>
        ///  &gt; ls -Name my-csr-directory | %{aws iot create-certificate-from-csr --certificate-signing-request
        /// file://my-csr-directory/$_} 
        /// </para>
        ///  
        /// <para>
        ///  On Windows Command Prompt, the command to create certificates for all CSRs in my-csr-directory
        /// is: 
        /// </para>
        ///  
        /// <para>
        ///  &gt; forfiles /p my-csr-directory /c "cmd /c aws iot create-certificate-from-csr
        /// --certificate-signing-request file://@path"
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the CreateCertificateFromCsr service method.</param>
        /// 
        /// <returns>The response from the CreateCertificateFromCsr service method, as returned by IoT.</returns>
        /// <exception cref="Amazon.IoT.Model.InternalFailureException">
        /// An unexpected error has occurred.
        /// </exception>
        /// <exception cref="Amazon.IoT.Model.InvalidRequestException">
        /// The request is not valid.
        /// </exception>
        /// <exception cref="Amazon.IoT.Model.ServiceUnavailableException">
        /// The service is temporarily unavailable.
        /// </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 CreateCertificateFromCsrResponse CreateCertificateFromCsr(CreateCertificateFromCsrRequest request)
        {
            var marshaller = new CreateCertificateFromCsrRequestMarshaller();
            var unmarshaller = CreateCertificateFromCsrResponseUnmarshaller.Instance;

            return Invoke<CreateCertificateFromCsrRequest,CreateCertificateFromCsrResponse>(request, marshaller, unmarshaller);
        }
Esempio n. 5
0
        public void CreateCertificateFromCsrMarshallTest()
        {
            var operation = service_model.FindOperation("CreateCertificateFromCsr");

            var request = InstantiateClassGenerator.Execute<CreateCertificateFromCsrRequest>();
            var marshaller = new CreateCertificateFromCsrRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);
            RequestValidator.Validate("CreateCertificateFromCsr", request, internalRequest, service_model);            

            var webResponse = new WebResponseData
            {
                Headers = {
                    {"x-amzn-RequestId", Guid.NewGuid().ToString()},
                    {"x-amz-crc32","0"}
                }
            };

            var payloadResponse = new JsonSampleGenerator(service_model, operation.ResponseStructure).Execute();
            webResponse.Headers.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(payloadResponse).Length.ToString());
            var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(payloadResponse), false, webResponse);
            ResponseUnmarshaller unmarshaller = CreateCertificateFromCsrResponseUnmarshaller.Instance;
            var response = unmarshaller.Unmarshall(context)
                as CreateCertificateFromCsrResponse;   
            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);               
        }