// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package lambda import ( "context" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/internal/awsutil" "github.com/aws/aws-sdk-go-v2/private/protocol" ) type UpdateFunctionCodeInput struct { _ struct{} `type:"structure"` // Set to true to validate the request parameters and access permissions without // modifying the function code. DryRun *bool `type:"boolean"` // The name of the Lambda function. // // Name formats // // * Function name - my-function. // // * Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function. // // * Partial ARN - 123456789012:function:my-function. // // The length constraint applies only to the full ARN. If you specify only the // function name, it is limited to 64 characters in length. // // FunctionName is a required field FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` // Set to true to publish a new version of the function after updating the code. // This has the same effect as calling PublishVersion separately. Publish *bool `type:"boolean"` // Only update the function if the revision ID matches the ID that's specified. // Use this option to avoid modifying a function that has changed since you // last read it. RevisionId *string `type:"string"` // An Amazon S3 bucket in the same AWS Region as your function. The bucket can // be in a different AWS account. S3Bucket *string `min:"3" type:"string"` // The Amazon S3 key of the deployment package. S3Key *string `min:"1" type:"string"` // For versioned objects, the version of the deployment package object to use. S3ObjectVersion *string `min:"1" type:"string"` // The base64-encoded contents of the deployment package. AWS SDK and AWS CLI // clients handle the encoding for you. // // ZipFile is automatically base64 encoded/decoded by the SDK. ZipFile []byte `type:"blob" sensitive:"true"` } // String returns the string representation func (s UpdateFunctionCodeInput) String() string { return awsutil.Prettify(s) } // Validate inspects the fields of the type to determine if they are valid. func (s *UpdateFunctionCodeInput) Validate() error { invalidParams := aws.ErrInvalidParams{Context: "UpdateFunctionCodeInput"} if s.FunctionName == nil { invalidParams.Add(aws.NewErrParamRequired("FunctionName")) } if s.FunctionName != nil && len(*s.FunctionName) < 1 { invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) } if s.S3Bucket != nil && len(*s.S3Bucket) < 3 { invalidParams.Add(aws.NewErrParamMinLen("S3Bucket", 3)) } if s.S3Key != nil && len(*s.S3Key) < 1 { invalidParams.Add(aws.NewErrParamMinLen("S3Key", 1)) } if s.S3ObjectVersion != nil && len(*s.S3ObjectVersion) < 1 { invalidParams.Add(aws.NewErrParamMinLen("S3ObjectVersion", 1)) } if invalidParams.Len() > 0 { return invalidParams } return nil } // MarshalFields encodes the AWS API shape using the passed in protocol encoder. func (s UpdateFunctionCodeInput) MarshalFields(e protocol.FieldEncoder) error { e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue("application/json"), protocol.Metadata{}) if s.DryRun != nil { v := *s.DryRun metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "DryRun", protocol.BoolValue(v), metadata) } if s.Publish != nil { v := *s.Publish metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "Publish", protocol.BoolValue(v), metadata) } if s.RevisionId != nil { v := *s.RevisionId metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "RevisionId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.S3Bucket != nil { v := *s.S3Bucket metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "S3Bucket", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.S3Key != nil { v := *s.S3Key metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "S3Key", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.S3ObjectVersion != nil { v := *s.S3ObjectVersion metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "S3ObjectVersion", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.ZipFile != nil { v := s.ZipFile metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "ZipFile", protocol.QuotedValue{ValueMarshaler: protocol.BytesValue(v)}, metadata) } if s.FunctionName != nil { v := *s.FunctionName metadata := protocol.Metadata{} e.SetValue(protocol.PathTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } return nil } // Details about a function's configuration. type UpdateFunctionCodeOutput struct { _ struct{} `type:"structure"` // The SHA256 hash of the function's deployment package. CodeSha256 *string `type:"string"` // The size of the function's deployment package, in bytes. CodeSize *int64 `type:"long"` // The function's dead letter queue. DeadLetterConfig *DeadLetterConfig `type:"structure"` // The function's description. Description *string `type:"string"` // The function's environment variables. Environment *EnvironmentResponse `type:"structure"` // Connection settings for an Amazon EFS file system. FileSystemConfigs []FileSystemConfig `type:"list"` // The function's Amazon Resource Name (ARN). FunctionArn *string `type:"string"` // The name of the function. FunctionName *string `min:"1" type:"string"` // The function that Lambda calls to begin executing your function. Handler *string `type:"string"` // The KMS key that's used to encrypt the function's environment variables. // This key is only returned if you've configured a customer managed CMK. KMSKeyArn *string `type:"string"` // The date and time that the function was last updated, in ISO-8601 format // (https://www.w3.org/TR/NOTE-datetime) (YYYY-MM-DDThh:mm:ss.sTZD). LastModified *string `type:"string"` // The status of the last update that was performed on the function. This is // first set to Successful after function creation completes. LastUpdateStatus LastUpdateStatus `type:"string" enum:"true"` // The reason for the last update that was performed on the function. LastUpdateStatusReason *string `type:"string"` // The reason code for the last update that was performed on the function. LastUpdateStatusReasonCode LastUpdateStatusReasonCode `type:"string" enum:"true"` // The function's layers (https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html). Layers []Layer `type:"list"` // For Lambda@Edge functions, the ARN of the master function. MasterArn *string `type:"string"` // The memory that's allocated to the function. MemorySize *int64 `min:"128" type:"integer"` // The latest updated revision of the function or alias. RevisionId *string `type:"string"` // The function's execution role. Role *string `type:"string"` // The runtime environment for the Lambda function. Runtime Runtime `type:"string" enum:"true"` // The current state of the function. When the state is Inactive, you can reactivate // the function by invoking it. State State `type:"string" enum:"true"` // The reason for the function's current state. StateReason *string `type:"string"` // The reason code for the function's current state. When the code is Creating, // you can't invoke or modify the function. StateReasonCode StateReasonCode `type:"string" enum:"true"` // The amount of time in seconds that Lambda allows a function to run before // stopping it. Timeout *int64 `min:"1" type:"integer"` // The function's AWS X-Ray tracing configuration. TracingConfig *TracingConfigResponse `type:"structure"` // The version of the Lambda function. Version *string `min:"1" type:"string"` // The function's networking configuration. VpcConfig *VpcConfigResponse `type:"structure"` } // String returns the string representation func (s UpdateFunctionCodeOutput) String() string { return awsutil.Prettify(s) } // MarshalFields encodes the AWS API shape using the passed in protocol encoder. func (s UpdateFunctionCodeOutput) MarshalFields(e protocol.FieldEncoder) error { if s.CodeSha256 != nil { v := *s.CodeSha256 metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "CodeSha256", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.CodeSize != nil { v := *s.CodeSize metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "CodeSize", protocol.Int64Value(v), metadata) } if s.DeadLetterConfig != nil { v := s.DeadLetterConfig metadata := protocol.Metadata{} e.SetFields(protocol.BodyTarget, "DeadLetterConfig", v, metadata) } if s.Description != nil { v := *s.Description metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "Description", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.Environment != nil { v := s.Environment metadata := protocol.Metadata{} e.SetFields(protocol.BodyTarget, "Environment", v, metadata) } if s.FileSystemConfigs != nil { v := s.FileSystemConfigs metadata := protocol.Metadata{} ls0 := e.List(protocol.BodyTarget, "FileSystemConfigs", metadata) ls0.Start() for _, v1 := range v { ls0.ListAddFields(v1) } ls0.End() } if s.FunctionArn != nil { v := *s.FunctionArn metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "FunctionArn", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.FunctionName != nil { v := *s.FunctionName metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.Handler != nil { v := *s.Handler metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "Handler", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.KMSKeyArn != nil { v := *s.KMSKeyArn metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "KMSKeyArn", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.LastModified != nil { v := *s.LastModified metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "LastModified", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if len(s.LastUpdateStatus) > 0 { v := s.LastUpdateStatus metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "LastUpdateStatus", protocol.QuotedValue{ValueMarshaler: v}, metadata) } if s.LastUpdateStatusReason != nil { v := *s.LastUpdateStatusReason metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "LastUpdateStatusReason", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if len(s.LastUpdateStatusReasonCode) > 0 { v := s.LastUpdateStatusReasonCode metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "LastUpdateStatusReasonCode", protocol.QuotedValue{ValueMarshaler: v}, metadata) } if s.Layers != nil { v := s.Layers metadata := protocol.Metadata{} ls0 := e.List(protocol.BodyTarget, "Layers", metadata) ls0.Start() for _, v1 := range v { ls0.ListAddFields(v1) } ls0.End() } if s.MasterArn != nil { v := *s.MasterArn metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "MasterArn", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.MemorySize != nil { v := *s.MemorySize metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "MemorySize", protocol.Int64Value(v), metadata) } if s.RevisionId != nil { v := *s.RevisionId metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "RevisionId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.Role != nil { v := *s.Role metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "Role", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if len(s.Runtime) > 0 { v := s.Runtime metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "Runtime", protocol.QuotedValue{ValueMarshaler: v}, metadata) } if len(s.State) > 0 { v := s.State metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "State", protocol.QuotedValue{ValueMarshaler: v}, metadata) } if s.StateReason != nil { v := *s.StateReason metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "StateReason", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if len(s.StateReasonCode) > 0 { v := s.StateReasonCode metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "StateReasonCode", protocol.QuotedValue{ValueMarshaler: v}, metadata) } if s.Timeout != nil { v := *s.Timeout metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "Timeout", protocol.Int64Value(v), metadata) } if s.TracingConfig != nil { v := s.TracingConfig metadata := protocol.Metadata{} e.SetFields(protocol.BodyTarget, "TracingConfig", v, metadata) } if s.Version != nil { v := *s.Version metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "Version", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.VpcConfig != nil { v := s.VpcConfig metadata := protocol.Metadata{} e.SetFields(protocol.BodyTarget, "VpcConfig", v, metadata) } return nil } const opUpdateFunctionCode = "UpdateFunctionCode" // UpdateFunctionCodeRequest returns a request value for making API operation for // AWS Lambda. // // Updates a Lambda function's code. // // The function's code is locked when you publish a version. You can't modify // the code of a published version, only the unpublished version. // // // Example sending a request using UpdateFunctionCodeRequest. // req := client.UpdateFunctionCodeRequest(params) // resp, err := req.Send(context.TODO()) // if err == nil { // fmt.Println(resp) // } // // Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateFunctionCode func (c *Client) UpdateFunctionCodeRequest(input *UpdateFunctionCodeInput) UpdateFunctionCodeRequest { op := &aws.Operation{ Name: opUpdateFunctionCode, HTTPMethod: "PUT", HTTPPath: "/2015-03-31/functions/{FunctionName}/code", } if input == nil { input = &UpdateFunctionCodeInput{} } req := c.newRequest(op, input, &UpdateFunctionCodeOutput{}) return UpdateFunctionCodeRequest{Request: req, Input: input, Copy: c.UpdateFunctionCodeRequest} } // UpdateFunctionCodeRequest is the request type for the // UpdateFunctionCode API operation. type UpdateFunctionCodeRequest struct { *aws.Request Input *UpdateFunctionCodeInput Copy func(*UpdateFunctionCodeInput) UpdateFunctionCodeRequest } // Send marshals and sends the UpdateFunctionCode API request. func (r UpdateFunctionCodeRequest) Send(ctx context.Context) (*UpdateFunctionCodeResponse, error) { r.Request.SetContext(ctx) err := r.Request.Send() if err != nil { return nil, err } resp := &UpdateFunctionCodeResponse{ UpdateFunctionCodeOutput: r.Request.Data.(*UpdateFunctionCodeOutput), response: &aws.Response{Request: r.Request}, } return resp, nil } // UpdateFunctionCodeResponse is the response type for the // UpdateFunctionCode API operation. type UpdateFunctionCodeResponse struct { *UpdateFunctionCodeOutput response *aws.Response } // SDKResponseMetdata returns the response metadata for the // UpdateFunctionCode request. func (r *UpdateFunctionCodeResponse) SDKResponseMetdata() *aws.Response { return r.response }