Ejemplo n.º 1
0
        /// <summary>
        /// Update the function version to which the alias points and the alias description.
        /// </summary>
        /// <param name="functionName">The name of an AWS Lambda function.</param>
        /// <param name="settings">The <see cref="AliasSettings"/> used during the request to AWS.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
        public async Task <bool> UpdateAlias(string functionName, AliasSettings settings, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (String.IsNullOrEmpty(functionName))
            {
                throw new ArgumentNullException(nameof(functionName));
            }



            // Create Request
            AmazonLambdaClient client = this.CreateClient(settings);

            UpdateAliasRequest request = new UpdateAliasRequest()
            {
                Name = settings.Name,

                FunctionName    = functionName,
                FunctionVersion = settings.Version,

                Description = settings.Description
            };



            // Check Response
            UpdateAliasResponse response = await client.UpdateAliasAsync(request, cancellationToken);

            if (response.HttpStatusCode == HttpStatusCode.OK)
            {
                _Log.Verbose("Successfully published function '{0}'", functionName);
                return(true);
            }
            else
            {
                _Log.Error("Failed to published function '{0}'", functionName);
                return(false);
            }
        }
Ejemplo n.º 2
0
 public static async Task <bool> UpdateLambdaAlias(this ICakeContext context, string functionName, AliasSettings settings)
 {
     return(await context.CreateManager().UpdateAlias(functionName, settings));
 }