Ejemplo n.º 1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Lambda.Model.DeleteFunctionRequest();

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

            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);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteFunction operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DeleteFunction 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<DeleteFunctionResponse> DeleteFunctionAsync(DeleteFunctionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DeleteFunctionRequestMarshaller();
            var unmarshaller = DeleteFunctionResponseUnmarshaller.Instance;

            return InvokeAsync<DeleteFunctionRequest,DeleteFunctionResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Deletes the specified Lambda function code and configuration.
 /// 
 ///  
 /// <para>
 /// If you are using the versioning feature and you don't specify a function version in
 /// your <code>DeleteFunction</code> request, AWS Lambda will delete the function, including
 /// all its versions, and any aliases pointing to the function versions. To delete a specific
 /// function version, you must provide the function version via the <code>Qualifier</code>
 /// parameter. For information about function versioning, see <a href="http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html">AWS
 /// Lambda Function Versioning and Aliases</a>. 
 /// </para>
 ///  
 /// <para>
 /// When you delete a function the associated resource policy is also deleted. You will
 /// need to delete the event source mappings explicitly.
 /// </para>
 ///  
 /// <para>
 /// This operation requires permission for the <code>lambda:DeleteFunction</code> action.
 /// </para>
 /// </summary>
 /// <param name="functionName">The Lambda function to delete.  You can specify the function name (for example, <code>Thumbnail</code>) or you can specify Amazon Resource Name (ARN) of the function (for example, <code>arn:aws:lambda:us-west-2:account-id:function:ThumbNail</code>). If you are using versioning, you can also provide a qualified function ARN (ARN that is qualified with function version or alias name as suffix). AWS Lambda also allows you to specify only the function name with the account ID qualifier (for example, <code>account-id:Thumbnail</code>). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length. </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 DeleteFunction service method, as returned by Lambda.</returns>
 /// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
 /// One of the parameters in the request is invalid. For example, if you provided an IAM
 /// role for AWS Lambda to assume in the <code>CreateFunction</code> or the <code>UpdateFunctionConfiguration</code>
 /// API, that AWS Lambda is unable to assume you will get this exception.
 /// </exception>
 /// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
 /// The resource already exists.
 /// </exception>
 /// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
 /// The resource (for example, a Lambda function or access policy statement) specified
 /// in the request does not exist.
 /// </exception>
 /// <exception cref="Amazon.Lambda.Model.ServiceException">
 /// The AWS Lambda service encountered an internal error.
 /// </exception>
 /// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
 /// 
 /// </exception>
 public Task<DeleteFunctionResponse> DeleteFunctionAsync(string functionName, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
 {
     var request = new DeleteFunctionRequest();
     request.FunctionName = functionName;
     return DeleteFunctionAsync(request, cancellationToken);
 }
Ejemplo n.º 4
0
        internal DeleteFunctionResponse DeleteFunction(DeleteFunctionRequest request)
        {
            var marshaller = new DeleteFunctionRequestMarshaller();
            var unmarshaller = DeleteFunctionResponseUnmarshaller.Instance;

            return Invoke<DeleteFunctionRequest,DeleteFunctionResponse>(request, marshaller, unmarshaller);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Deletes the specified Lambda function code and configuration.
 /// 
 ///  
 /// <para>
 /// If you are using the versioning feature and you don't specify a function version in
 /// your <code>DeleteFunction</code> request, AWS Lambda will delete the function, including
 /// all its versions, and any aliases pointing to the function versions. To delete a specific
 /// function version, you must provide the function version via the <code>Qualifier</code>
 /// parameter. For information about function versioning, see <a href="http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html">AWS
 /// Lambda Function Versioning and Aliases</a>. 
 /// </para>
 ///  
 /// <para>
 /// When you delete a function the associated resource policy is also deleted. You will
 /// need to delete the event source mappings explicitly.
 /// </para>
 ///  
 /// <para>
 /// This operation requires permission for the <code>lambda:DeleteFunction</code> action.
 /// </para>
 /// </summary>
 /// <param name="functionName">The Lambda function to delete.  You can specify the function name (for example, <code>Thumbnail</code>) or you can specify Amazon Resource Name (ARN) of the function (for example, <code>arn:aws:lambda:us-west-2:account-id:function:ThumbNail</code>). If you are using versioning, you can also provide a qualified function ARN (ARN that is qualified with function version or alias name as suffix). AWS Lambda also allows you to specify only the function name with the account ID qualifier (for example, <code>account-id:Thumbnail</code>). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length. </param>
 /// 
 /// <returns>The response from the DeleteFunction service method, as returned by Lambda.</returns>
 /// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
 /// One of the parameters in the request is invalid. For example, if you provided an IAM
 /// role for AWS Lambda to assume in the <code>CreateFunction</code> or the <code>UpdateFunctionConfiguration</code>
 /// API, that AWS Lambda is unable to assume you will get this exception.
 /// </exception>
 /// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
 /// The resource already exists.
 /// </exception>
 /// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
 /// The resource (for example, a Lambda function or access policy statement) specified
 /// in the request does not exist.
 /// </exception>
 /// <exception cref="Amazon.Lambda.Model.ServiceException">
 /// The AWS Lambda service encountered an internal error.
 /// </exception>
 /// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
 /// 
 /// </exception>
 public DeleteFunctionResponse DeleteFunction(string functionName)
 {
     var request = new DeleteFunctionRequest();
     request.FunctionName = functionName;
     return DeleteFunction(request);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteFunction operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DeleteFunction operation on AmazonLambdaClient.</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 EndDeleteFunction
        ///         operation.</returns>
        public IAsyncResult BeginDeleteFunction(DeleteFunctionRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new DeleteFunctionRequestMarshaller();
            var unmarshaller = DeleteFunctionResponseUnmarshaller.Instance;

            return BeginInvoke<DeleteFunctionRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Initiates the asynchronous execution of the DeleteFunction operation.
 /// This API is supported only when AWSConfigs.HttpClient is set to AWSConfigs.HttpClientOption.UnityWebRequest, the default value for this configuration option is AWSConfigs.HttpClientOption.UnityWWW
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the DeleteFunction operation on AmazonLambdaClient.</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 DeleteFunctionAsync(DeleteFunctionRequest request, AmazonServiceCallback<DeleteFunctionRequest, DeleteFunctionResponse> callback, AsyncOptions options = null)
 {
     if (AWSConfigs.HttpClient == AWSConfigs.HttpClientOption.UnityWWW)
     {
         throw new InvalidOperationException("DeleteFunction is only allowed with AWSConfigs.HttpClientOption.UnityWebRequest API option");
     }
     options = options == null?new AsyncOptions():options;
     var marshaller = new DeleteFunctionRequestMarshaller();
     var unmarshaller = DeleteFunctionResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<DeleteFunctionRequest,DeleteFunctionResponse> responseObject 
                     = new AmazonServiceResult<DeleteFunctionRequest,DeleteFunctionResponse>((DeleteFunctionRequest)req, (DeleteFunctionResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<DeleteFunctionRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Deletes the specified Lambda function code and configuration.
 /// 
 ///  
 /// <para>
 /// If you are using the versioning feature and you don't specify a function version in
 /// your <code>DeleteFunction</code> request, AWS Lambda will delete the function, including
 /// all its versions, and any aliases pointing to the function versions. To delete a specific
 /// function version, you must provide the function version via the <code>Qualifier</code>
 /// parameter. For information about function versioning, see <a href="http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html">AWS
 /// Lambda Function Versioning and Aliases</a>. 
 /// </para>
 ///  
 /// <para>
 /// When you delete a function the associated resource policy is also deleted. You will
 /// need to delete the event source mappings explicitly.
 /// </para>
 ///  
 /// <para>
 /// This operation requires permission for the <code>lambda:DeleteFunction</code> action.
 /// </para>
 /// This API is supported only when AWSConfigs.HttpClient is set to AWSConfigs.HttpClientOption.UnityWebRequest, the default value of this configuration option is AWSConfigs.HttpClientOption.UnityWWW
 /// </summary>
 /// <param name="functionName">The Lambda function to delete.  You can specify the function name (for example, <code>Thumbnail</code>) or you can specify Amazon Resource Name (ARN) of the function (for example, <code>arn:aws:lambda:us-west-2:account-id:function:ThumbNail</code>). If you are using versioning, you can also provide a qualified function ARN (ARN that is qualified with function version or alias name as suffix). AWS Lambda also allows you to specify only the function name with the account ID qualifier (for example, <code>account-id:Thumbnail</code>). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length. </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>
 /// 
 /// <returns>The response from the DeleteFunction service method, as returned by Lambda.</returns>
 /// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
 /// One of the parameters in the request is invalid. For example, if you provided an IAM
 /// role for AWS Lambda to assume in the <code>CreateFunction</code> or the <code>UpdateFunctionConfiguration</code>
 /// API, that AWS Lambda is unable to assume you will get this exception.
 /// </exception>
 /// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
 /// The resource already exists.
 /// </exception>
 /// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
 /// The resource (for example, a Lambda function or access policy statement) specified
 /// in the request does not exist.
 /// </exception>
 /// <exception cref="Amazon.Lambda.Model.ServiceException">
 /// The AWS Lambda service encountered an internal error.
 /// </exception>
 /// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
 /// 
 /// </exception>
 public void DeleteFunctionAsync(string functionName,  AmazonServiceCallback<DeleteFunctionRequest, DeleteFunctionResponse> callback, AsyncOptions options = null)
 {
     var request = new DeleteFunctionRequest();
     request.FunctionName = functionName;
     DeleteFunctionAsync(request, callback, options);
 }
Ejemplo n.º 9
0
 private Amazon.Lambda.Model.DeleteFunctionResponse CallAWSServiceOperation(IAmazonLambda client, Amazon.Lambda.Model.DeleteFunctionRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Lambda", "DeleteFunction");
     try
     {
         #if DESKTOP
         return(client.DeleteFunction(request));
         #elif CORECLR
         return(client.DeleteFunctionAsync(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;
     }
 }