Container for the parameters to the CreateAccessKey operation.

Creates a new AWS secret access key and corresponding AWS access key ID for the specified user. The default status for new keys is Active .

If you do not specify a user name, IAM determines the user name implicitly based on the AWS access key ID signing the request. Because this action works for access keys under the AWS account, you can use this API to manage root credentials even if the AWS account has no associated users.

For information about limits on the number of keys you can create, see Limitations on IAM Entities in Using AWS Identity and Access Management .

IMPORTANT:To ensure the security of your AWS account, the secret access key is accessible only during key and user creation. You must save the key (for example, in a text file) if you want to be able to access it again. If a secret key is lost, you can delete the access keys for the associated user and then create new keys.

Inheritance: AmazonIdentityManagementServiceRequest
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.IdentityManagement.Model.CreateAccessKeyRequest();

            if (cmdletContext.UserName != null)
            {
                request.UserName = cmdletContext.UserName;
            }

            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);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the CreateAccessKey operation.
        /// <seealso cref="Amazon.IdentityManagement.IAmazonIdentityManagementService"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateAccessKey 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<CreateAccessKeyResponse> CreateAccessKeyAsync(CreateAccessKeyRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateAccessKeyRequestMarshaller();
            var unmarshaller = CreateAccessKeyResponseUnmarshaller.Instance;

            return InvokeAsync<CreateAccessKeyRequest,CreateAccessKeyResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
        internal CreateAccessKeyResponse CreateAccessKey(CreateAccessKeyRequest request)
        {
            var marshaller = new CreateAccessKeyRequestMarshaller();
            var unmarshaller = CreateAccessKeyResponseUnmarshaller.Instance;

            return Invoke<CreateAccessKeyRequest,CreateAccessKeyResponse>(request, marshaller, unmarshaller);
        }
 IAsyncResult invokeCreateAccessKey(CreateAccessKeyRequest createAccessKeyRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new CreateAccessKeyRequestMarshaller().Marshall(createAccessKeyRequest);
     var unmarshaller = CreateAccessKeyResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
 /// <summary>
 /// Initiates the asynchronous execution of the CreateAccessKey operation.
 /// <seealso cref="Amazon.IdentityManagement.AmazonIdentityManagementService.CreateAccessKey"/>
 /// </summary>
 /// 
 /// <param name="createAccessKeyRequest">Container for the necessary parameters to execute the CreateAccessKey operation on
 ///          AmazonIdentityManagementService.</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 EndCreateAccessKey
 ///         operation.</returns>
 public IAsyncResult BeginCreateAccessKey(CreateAccessKeyRequest createAccessKeyRequest, AsyncCallback callback, object state)
 {
     return invokeCreateAccessKey(createAccessKeyRequest, callback, state, false);
 }
 /// <summary>
 /// <para>Creates a new AWS Secret Access Key and corresponding AWS Access Key ID for the specified user. The default status for new keys is
 /// <c>Active</c> .</para> <para>If you do not specify a user name, IAM determines the user name implicitly based on the AWS Access Key ID
 /// signing the request. Because this action works for access keys under the AWS account, you can use this API to manage root credentials even
 /// if the AWS account has no associated users.</para> <para>For information about limits on the number of keys you can create, see Limitations
 /// on IAM Entities in <i>Using AWS Identity and Access Management</i> .</para> <para><b>IMPORTANT:</b>To ensure the security of your AWS
 /// account, the Secret Access Key is accessible only during key and user creation. You must save the key (for example, in a text file) if you
 /// want to be able to access it again. If a secret key is lost, you can delete the access keys for the associated user and then create new
 /// keys.</para>
 /// </summary>
 /// 
 /// <param name="createAccessKeyRequest">Container for the necessary parameters to execute the CreateAccessKey service method on
 ///          AmazonIdentityManagementService.</param>
 /// 
 /// <returns>The response from the CreateAccessKey service method, as returned by AmazonIdentityManagementService.</returns>
 /// 
 /// <exception cref="NoSuchEntityException"/>
 /// <exception cref="LimitExceededException"/>
 public CreateAccessKeyResponse CreateAccessKey(CreateAccessKeyRequest createAccessKeyRequest)
 {
     IAsyncResult asyncResult = invokeCreateAccessKey(createAccessKeyRequest, null, null, true);
     return EndCreateAccessKey(asyncResult);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the CreateAccessKey operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateAccessKey operation on AmazonIdentityManagementServiceClient.</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 EndCreateAccessKey
        ///         operation.</returns>
        public IAsyncResult BeginCreateAccessKey(CreateAccessKeyRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new CreateAccessKeyRequestMarshaller();
            var unmarshaller = CreateAccessKeyResponseUnmarshaller.Instance;

            return BeginInvoke<CreateAccessKeyRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
 /// <summary>
 /// <para>Creates a new AWS Secret Access Key and corresponding AWS Access
 /// Key ID for the specified User. The default status for new keys is
 /// <c>Active</c> .</para> <para>If you do not specify a User name, IAM
 /// determines the User name implicitly based on the AWS Access Key ID
 /// signing the request. Because this action works for access keys under
 /// the AWS Account, you can use this API to manage root credentials even
 /// if the AWS Account has no associated Users.</para> <para>For
 /// information about limits on the number of keys you can create, see
 /// Limitations on IAM Entities in Using AWS Identity and Access
 /// Management.</para> <para><b>IMPORTANT:</b>To ensure the security of
 /// your AWS Account, the Secret Access Key is accessible only during key
 /// and User creation. You must save the key (for example, in a text
 /// file) if you want to be able to access it again. If a secret key is
 /// lost, you can delete the access keys for the associated User and then
 /// create new keys.</para>
 /// </summary>
 /// 
 /// <param name="createAccessKeyRequest">Container for the necessary
 ///           parameters to execute the CreateAccessKey service method on
 ///           AmazonIdentityManagementService.</param>
 /// 
 /// <returns>The response from the CreateAccessKey service method, as
 ///         returned by AmazonIdentityManagementService.</returns>
 /// 
 /// <exception cref="NoSuchEntityException"/>
 /// <exception cref="LimitExceededException"/>
 public CreateAccessKeyResponse CreateAccessKey(CreateAccessKeyRequest createAccessKeyRequest)
 {
     IRequest<CreateAccessKeyRequest> request = new CreateAccessKeyRequestMarshaller().Marshall(createAccessKeyRequest);
     CreateAccessKeyResponse response = Invoke<CreateAccessKeyRequest, CreateAccessKeyResponse> (request, this.signer, CreateAccessKeyResponseUnmarshaller.GetInstance());
     return response;
 }
 /// <summary>
 /// Initiates the asynchronous execution of the CreateAccessKey operation.
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the CreateAccessKey operation on AmazonIdentityManagementServiceClient.</param>
 /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
 /// <param name="options">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>
 public void CreateAccessKeyAsync(CreateAccessKeyRequest request, AmazonServiceCallback<CreateAccessKeyRequest, CreateAccessKeyResponse> callback, AsyncOptions options = null)
 {
     options = options == null?new AsyncOptions():options;
     var marshaller = new CreateAccessKeyRequestMarshaller();
     var unmarshaller = CreateAccessKeyResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<CreateAccessKeyRequest,CreateAccessKeyResponse> responseObject 
                     = new AmazonServiceResult<CreateAccessKeyRequest,CreateAccessKeyResponse>((CreateAccessKeyRequest)req, (CreateAccessKeyResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<CreateAccessKeyRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the CreateAccessKey operation.
        /// <seealso cref="Amazon.IdentityManagement.IAmazonIdentityManagementService.CreateAccessKey"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateAccessKey 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 async Task<CreateAccessKeyResponse> CreateAccessKeyAsync(CreateAccessKeyRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateAccessKeyRequestMarshaller();
            var unmarshaller = CreateAccessKeyResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, CreateAccessKeyRequest, CreateAccessKeyResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
        /// <summary>
        /// <para>Creates a new AWS secret access key and corresponding AWS access key ID for the specified user. The default status for new keys is
        /// <c>Active</c> .</para> <para>If you do not specify a user name, IAM determines the user name implicitly based on the AWS access key ID
        /// signing the request. Because this action works for access keys under the AWS account, you can use this API to manage root credentials even
        /// if the AWS account has no associated users.</para> <para>For information about limits on the number of keys you can create, see <a href="http://docs.aws.amazon.com/IAM/latest/UserGuide/index.html?LimitationsOnEntities.html">Limitations on IAM Entities</a> in <i>Using
        /// AWS Identity and Access Management</i> .</para> <para><b>IMPORTANT:</b>To ensure the security of your AWS account, the secret access key is
        /// accessible only during key and user creation. You must save the key (for example, in a text file) if you want to be able to access it again.
        /// If a secret key is lost, you can delete the access keys for the associated user and then create new keys.</para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateAccessKey service method on
        /// AmazonIdentityManagementService.</param>
        /// 
        /// <returns>The response from the CreateAccessKey service method, as returned by AmazonIdentityManagementService.</returns>
        /// 
        /// <exception cref="T:Amazon.IdentityManagement.Model.NoSuchEntityException" />
        /// <exception cref="T:Amazon.IdentityManagement.Model.LimitExceededException" />
		public CreateAccessKeyResponse CreateAccessKey(CreateAccessKeyRequest request)
        {
            var task = CreateAccessKeyAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
 private Amazon.IdentityManagement.Model.CreateAccessKeyResponse CallAWSServiceOperation(IAmazonIdentityManagementService client, Amazon.IdentityManagement.Model.CreateAccessKeyRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Identity and Access Management", "CreateAccessKey");
     try
     {
         #if DESKTOP
         return(client.CreateAccessKey(request));
         #elif CORECLR
         return(client.CreateAccessKeyAsync(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;
     }
 }
Example #13
0
        /// <summary>
        /// <para>Creates a new AWS secret access key and corresponding AWS access key ID for the specified user. The default status for new keys is
        /// <c>Active</c> .</para> <para>If you do not specify a user name, IAM determines the user name implicitly based on the AWS access key ID
        /// signing the request. Because this action works for access keys under the AWS account, you can use this API to manage root credentials even
        /// if the AWS account has no associated users.</para> <para>For information about limits on the number of keys you can create, see <a href="http://docs.aws.amazon.com/IAM/latest/UserGuide/index.html?LimitationsOnEntities.html">Limitations on IAM Entities</a> in <i>Using
        /// AWS Identity and Access Management</i> .</para> <para><b>IMPORTANT:</b>To ensure the security of your AWS account, the secret access key is
        /// accessible only during key and user creation. You must save the key (for example, in a text file) if you want to be able to access it again.
        /// If a secret key is lost, you can delete the access keys for the associated user and then create new keys.</para>
        /// </summary>
        /// 
        /// <param name="createAccessKeyRequest">Container for the necessary parameters to execute the CreateAccessKey service method on
        /// AmazonIdentityManagementService.</param>
        /// 
        /// <returns>The response from the CreateAccessKey service method, as returned by AmazonIdentityManagementService.</returns>
        /// 
        /// <exception cref="T:Amazon.IdentityManagement.Model.NoSuchEntityException" />
        /// <exception cref="T:Amazon.IdentityManagement.Model.LimitExceededException" />
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public Task<CreateAccessKeyResponse> CreateAccessKeyAsync(CreateAccessKeyRequest createAccessKeyRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateAccessKeyRequestMarshaller();
            var unmarshaller = CreateAccessKeyResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, CreateAccessKeyRequest, CreateAccessKeyResponse>(createAccessKeyRequest, marshaller, unmarshaller, signer, cancellationToken);
        }
Example #14
0
		internal CreateAccessKeyResponse CreateAccessKey(CreateAccessKeyRequest request)
        {
            var task = CreateAccessKeyAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
        IAsyncResult invokeCreateAccessKey(CreateAccessKeyRequest request, AsyncCallback callback, object state, bool synchronized)
        {
            var marshaller = new CreateAccessKeyRequestMarshaller();
            var unmarshaller = CreateAccessKeyResponseUnmarshaller.Instance;

            return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer);
        }
        /// <summary>
        /// Just playing with this for now.
        /// </summary>
        /// <param name="aprofile"></param>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public string CreateIAMAccount(string aprofile, string username, string password)
        {
            string IRReturning = "Yop";
            var credential = new Amazon.Runtime.StoredProfileAWSCredentials(aprofile);
            var iam = new AmazonIdentityManagementServiceClient(credential);

            CreateUserRequest request = new CreateUserRequest();
            request.UserName = username;

            var repo = iam.CreateUser(request);
            var det = repo.ResponseMetadata;

            CreateAccessKeyRequest KeyRequest = new CreateAccessKeyRequest();
            KeyRequest.UserName = username;




            return IRReturning;
        }