Container for the parameters to the GenerateRandom operation. Generates an unpredictable byte string.
Inheritance: AmazonKeyManagementServiceRequest
示例#1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.KeyManagementService.Model.GenerateRandomRequest();

            if (cmdletContext.CustomKeyStoreId != null)
            {
                request.CustomKeyStoreId = cmdletContext.CustomKeyStoreId;
            }
            if (cmdletContext.NumberOfBytes != null)
            {
                request.NumberOfBytes = cmdletContext.NumberOfBytes.Value;
            }

            CmdletOutput output;

            // issue call
            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            try
            {
                var    response       = CallAWSServiceOperation(client, request);
                object pipelineOutput = null;
                pipelineOutput = cmdletContext.Select(response, this);
                output         = new CmdletOutput
                {
                    PipelineOutput  = pipelineOutput,
                    ServiceResponse = response
                };
            }
            catch (Exception e)
            {
                output = new CmdletOutput {
                    ErrorResponse = e
                };
            }

            return(output);
        }
示例#2
0
 private Amazon.KeyManagementService.Model.GenerateRandomResponse CallAWSServiceOperation(IAmazonKeyManagementService client, Amazon.KeyManagementService.Model.GenerateRandomRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Key Management Service", "GenerateRandom");
     try
     {
         #if DESKTOP
         return(client.GenerateRandom(request));
         #elif CORECLR
         return(client.GenerateRandomAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
        /// <summary>
        /// Initiates the asynchronous execution of the GenerateRandom operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GenerateRandom 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<GenerateRandomResponse> GenerateRandomAsync(GenerateRandomRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new GenerateRandomRequestMarshaller();
            var unmarshaller = GenerateRandomResponseUnmarshaller.Instance;

            return InvokeAsync<GenerateRandomRequest,GenerateRandomResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
 /// <summary>
 /// Generates an unpredictable byte string.
 /// </summary>
 /// <param name="numberOfBytes">Integer that contains the number of bytes to generate. Common values are 128, 256, 512, 1024 and so on. The current limit is 1024 bytes. </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 GenerateRandom service method, as returned by KeyManagementService.</returns>
 /// <exception cref="Amazon.KeyManagementService.Model.DependencyTimeoutException">
 /// The system timed out while trying to fulfill the request.
 /// </exception>
 /// <exception cref="Amazon.KeyManagementService.Model.KMSInternalException">
 /// The request was rejected because an internal exception occurred. This error can be
 /// retried.
 /// </exception>
 public Task<GenerateRandomResponse> GenerateRandomAsync(int numberOfBytes, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
 {
     var request = new GenerateRandomRequest();
     request.NumberOfBytes = numberOfBytes;
     return GenerateRandomAsync(request, cancellationToken);
 }
        /// <summary>
        /// Generates an unpredictable byte string.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the GenerateRandom service method.</param>
        /// 
        /// <returns>The response from the GenerateRandom service method, as returned by KeyManagementService.</returns>
        /// <exception cref="Amazon.KeyManagementService.Model.DependencyTimeoutException">
        /// The system timed out while trying to fulfill the request.
        /// </exception>
        /// <exception cref="Amazon.KeyManagementService.Model.KMSInternalException">
        /// The request was rejected because an internal exception occurred. This error can be
        /// retried.
        /// </exception>
        public GenerateRandomResponse GenerateRandom(GenerateRandomRequest request)
        {
            var marshaller = new GenerateRandomRequestMarshaller();
            var unmarshaller = GenerateRandomResponseUnmarshaller.Instance;

            return Invoke<GenerateRandomRequest,GenerateRandomResponse>(request, marshaller, unmarshaller);
        }
 /// <summary>
 /// Generates an unpredictable byte string.
 /// </summary>
 /// <param name="numberOfBytes">Integer that contains the number of bytes to generate. Common values are 128, 256, 512, 1024 and so on. The current limit is 1024 bytes. </param>
 /// 
 /// <returns>The response from the GenerateRandom service method, as returned by KeyManagementService.</returns>
 /// <exception cref="Amazon.KeyManagementService.Model.DependencyTimeoutException">
 /// The system timed out while trying to fulfill the request.
 /// </exception>
 /// <exception cref="Amazon.KeyManagementService.Model.KMSInternalException">
 /// The request was rejected because an internal exception occurred. This error can be
 /// retried.
 /// </exception>
 public GenerateRandomResponse GenerateRandom(int numberOfBytes)
 {
     var request = new GenerateRandomRequest();
     request.NumberOfBytes = numberOfBytes;
     return GenerateRandom(request);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the GenerateRandom operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GenerateRandom operation on AmazonKeyManagementServiceClient.</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 EndGenerateRandom
        ///         operation.</returns>
        public IAsyncResult BeginGenerateRandom(GenerateRandomRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new GenerateRandomRequestMarshaller();
            var unmarshaller = GenerateRandomResponseUnmarshaller.Instance;

            return BeginInvoke<GenerateRandomRequest>(request, marshaller, unmarshaller,
                callback, state);
        }