api_op_UpdateLoadBalancerAttribute.go raw

   1  // Code generated by smithy-go-codegen DO NOT EDIT.
   2  
   3  package lightsail
   4  
   5  import (
   6  	"context"
   7  	"fmt"
   8  	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
   9  	"github.com/aws/aws-sdk-go-v2/service/lightsail/types"
  10  	"github.com/aws/smithy-go/middleware"
  11  	smithyhttp "github.com/aws/smithy-go/transport/http"
  12  )
  13  
  14  // Updates the specified attribute for a load balancer. You can only update one
  15  // attribute at a time.
  16  //
  17  // The update load balancer attribute operation supports tag-based access control
  18  // via resource tags applied to the resource identified by load balancer name . For
  19  // more information, see the [Amazon Lightsail Developer Guide].
  20  //
  21  // [Amazon Lightsail Developer Guide]: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-controlling-access-using-tags
  22  func (c *Client) UpdateLoadBalancerAttribute(ctx context.Context, params *UpdateLoadBalancerAttributeInput, optFns ...func(*Options)) (*UpdateLoadBalancerAttributeOutput, error) {
  23  	if params == nil {
  24  		params = &UpdateLoadBalancerAttributeInput{}
  25  	}
  26  
  27  	result, metadata, err := c.invokeOperation(ctx, "UpdateLoadBalancerAttribute", params, optFns, c.addOperationUpdateLoadBalancerAttributeMiddlewares)
  28  	if err != nil {
  29  		return nil, err
  30  	}
  31  
  32  	out := result.(*UpdateLoadBalancerAttributeOutput)
  33  	out.ResultMetadata = metadata
  34  	return out, nil
  35  }
  36  
  37  type UpdateLoadBalancerAttributeInput struct {
  38  
  39  	// The name of the attribute you want to update.
  40  	//
  41  	// This member is required.
  42  	AttributeName types.LoadBalancerAttributeName
  43  
  44  	// The value that you want to specify for the attribute name.
  45  	//
  46  	// The following values are supported depending on what you specify for the
  47  	// attributeName request parameter:
  48  	//
  49  	//   - If you specify HealthCheckPath for the attributeName request parameter, then
  50  	//   the attributeValue request parameter must be the path to ping on the target
  51  	//   (for example, /weather/us/wa/seattle ).
  52  	//
  53  	//   - If you specify SessionStickinessEnabled for the attributeName request
  54  	//   parameter, then the attributeValue request parameter must be true to activate
  55  	//   session stickiness or false to deactivate session stickiness.
  56  	//
  57  	//   - If you specify SessionStickiness_LB_CookieDurationSeconds for the
  58  	//   attributeName request parameter, then the attributeValue request parameter
  59  	//   must be an interger that represents the cookie duration in seconds.
  60  	//
  61  	//   - If you specify HttpsRedirectionEnabled for the attributeName request
  62  	//   parameter, then the attributeValue request parameter must be true to activate
  63  	//   HTTP to HTTPS redirection or false to deactivate HTTP to HTTPS redirection.
  64  	//
  65  	//   - If you specify TlsPolicyName for the attributeName request parameter, then
  66  	//   the attributeValue request parameter must be the name of the TLS policy.
  67  	//
  68  	// Use the [GetLoadBalancerTlsPolicies]action to get a list of TLS policy names that you can specify.
  69  	//
  70  	// [GetLoadBalancerTlsPolicies]: https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetLoadBalancerTlsPolicies.html
  71  	//
  72  	// This member is required.
  73  	AttributeValue *string
  74  
  75  	// The name of the load balancer that you want to modify ( my-load-balancer .
  76  	//
  77  	// This member is required.
  78  	LoadBalancerName *string
  79  
  80  	noSmithyDocumentSerde
  81  }
  82  
  83  type UpdateLoadBalancerAttributeOutput struct {
  84  
  85  	// An array of objects that describe the result of the action, such as the status
  86  	// of the request, the timestamp of the request, and the resources affected by the
  87  	// request.
  88  	Operations []types.Operation
  89  
  90  	// Metadata pertaining to the operation's result.
  91  	ResultMetadata middleware.Metadata
  92  
  93  	noSmithyDocumentSerde
  94  }
  95  
  96  func (c *Client) addOperationUpdateLoadBalancerAttributeMiddlewares(stack *middleware.Stack, options Options) (err error) {
  97  	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
  98  		return err
  99  	}
 100  	err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateLoadBalancerAttribute{}, middleware.After)
 101  	if err != nil {
 102  		return err
 103  	}
 104  	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateLoadBalancerAttribute{}, middleware.After)
 105  	if err != nil {
 106  		return err
 107  	}
 108  	if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateLoadBalancerAttribute"); err != nil {
 109  		return fmt.Errorf("add protocol finalizers: %v", err)
 110  	}
 111  
 112  	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
 113  		return err
 114  	}
 115  	if err = addSetLoggerMiddleware(stack, options); err != nil {
 116  		return err
 117  	}
 118  	if err = addClientRequestID(stack); err != nil {
 119  		return err
 120  	}
 121  	if err = addComputeContentLength(stack); err != nil {
 122  		return err
 123  	}
 124  	if err = addResolveEndpointMiddleware(stack, options); err != nil {
 125  		return err
 126  	}
 127  	if err = addComputePayloadSHA256(stack); err != nil {
 128  		return err
 129  	}
 130  	if err = addRetry(stack, options); err != nil {
 131  		return err
 132  	}
 133  	if err = addRawResponseToMetadata(stack); err != nil {
 134  		return err
 135  	}
 136  	if err = addRecordResponseTiming(stack); err != nil {
 137  		return err
 138  	}
 139  	if err = addSpanRetryLoop(stack, options); err != nil {
 140  		return err
 141  	}
 142  	if err = addClientUserAgent(stack, options); err != nil {
 143  		return err
 144  	}
 145  	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
 146  		return err
 147  	}
 148  	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
 149  		return err
 150  	}
 151  	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
 152  		return err
 153  	}
 154  	if err = addTimeOffsetBuild(stack, c); err != nil {
 155  		return err
 156  	}
 157  	if err = addUserAgentRetryMode(stack, options); err != nil {
 158  		return err
 159  	}
 160  	if err = addCredentialSource(stack, options); err != nil {
 161  		return err
 162  	}
 163  	if err = addOpUpdateLoadBalancerAttributeValidationMiddleware(stack); err != nil {
 164  		return err
 165  	}
 166  	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateLoadBalancerAttribute(options.Region), middleware.Before); err != nil {
 167  		return err
 168  	}
 169  	if err = addRecursionDetection(stack); err != nil {
 170  		return err
 171  	}
 172  	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
 173  		return err
 174  	}
 175  	if err = addResponseErrorMiddleware(stack); err != nil {
 176  		return err
 177  	}
 178  	if err = addRequestResponseLogging(stack, options); err != nil {
 179  		return err
 180  	}
 181  	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
 182  		return err
 183  	}
 184  	if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
 185  		return err
 186  	}
 187  	if err = addInterceptAttempt(stack, options); err != nil {
 188  		return err
 189  	}
 190  	if err = addInterceptors(stack, options); err != nil {
 191  		return err
 192  	}
 193  	return nil
 194  }
 195  
 196  func newServiceMetadataMiddleware_opUpdateLoadBalancerAttribute(region string) *awsmiddleware.RegisterServiceMetadata {
 197  	return &awsmiddleware.RegisterServiceMetadata{
 198  		Region:        region,
 199  		ServiceID:     ServiceID,
 200  		OperationName: "UpdateLoadBalancerAttribute",
 201  	}
 202  }
 203