1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
|
// Code generated by smithy-go-codegen DO NOT EDIT.
package opsworks
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/opsworks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a layer. For more information, see How to Create a Layer (https://docs.aws.amazon.com/opsworks/latest/userguide/workinglayers-basics-create.html)
// . You should use CreateLayer for noncustom layer types such as PHP App Server
// only if the stack does not have an existing layer of that type. A stack can have
// at most one instance of each noncustom layer; if you attempt to create a second
// instance, CreateLayer fails. A stack can have an arbitrary number of custom
// layers, so you can call CreateLayer as many times as you like for that layer
// type. Required Permissions: To use this action, an IAM user must have a Manage
// permissions level for the stack, or an attached policy that explicitly grants
// permissions. For more information on user permissions, see Managing User
// Permissions (https://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html)
// .
func (c *Client) CreateLayer(ctx context.Context, params *CreateLayerInput, optFns ...func(*Options)) (*CreateLayerOutput, error) {
if params == nil {
params = &CreateLayerInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateLayer", params, optFns, c.addOperationCreateLayerMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateLayerOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateLayerInput struct {
// The layer name, which is used by the console.
//
// This member is required.
Name *string
// For custom layers only, use this parameter to specify the layer's short name,
// which is used internally by AWS OpsWorks Stacks and by Chef recipes. The short
// name is also used as the name for the directory where your app files are
// installed. It can have a maximum of 200 characters, which are limited to the
// alphanumeric characters, '-', '_', and '.'. The built-in layers' short names are
// defined by AWS OpsWorks Stacks. For more information, see the Layer Reference (https://docs.aws.amazon.com/opsworks/latest/userguide/layers.html)
// .
//
// This member is required.
Shortname *string
// The layer stack ID.
//
// This member is required.
StackId *string
// The layer type. A stack cannot have more than one built-in layer of the same
// type. It can have any number of custom layers. Built-in layers are not available
// in Chef 12 stacks.
//
// This member is required.
Type types.LayerType
// One or more user-defined key-value pairs to be added to the stack attributes.
// To create a cluster layer, set the EcsClusterArn attribute to the cluster's ARN.
Attributes map[string]string
// Whether to automatically assign an Elastic IP address (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html)
// to the layer's instances. For more information, see How to Edit a Layer (https://docs.aws.amazon.com/opsworks/latest/userguide/workinglayers-basics-edit.html)
// .
AutoAssignElasticIps *bool
// For stacks that are running in a VPC, whether to automatically assign a public
// IP address to the layer's instances. For more information, see How to Edit a
// Layer (https://docs.aws.amazon.com/opsworks/latest/userguide/workinglayers-basics-edit.html)
// .
AutoAssignPublicIps *bool
// Specifies CloudWatch Logs configuration options for the layer. For more
// information, see CloudWatchLogsLogStream .
CloudWatchLogsConfiguration *types.CloudWatchLogsConfiguration
// The ARN of an IAM profile to be used for the layer's EC2 instances. For more
// information about IAM ARNs, see Using Identifiers (https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html)
// .
CustomInstanceProfileArn *string
// A JSON-formatted string containing custom stack configuration and deployment
// attributes to be installed on the layer's instances. For more information, see
// Using Custom JSON (https://docs.aws.amazon.com/opsworks/latest/userguide/workingcookbook-json-override.html)
// . This feature is supported as of version 1.7.42 of the AWS CLI.
CustomJson *string
// A LayerCustomRecipes object that specifies the layer custom recipes.
CustomRecipes *types.Recipes
// An array containing the layer custom security group IDs.
CustomSecurityGroupIds []string
// Whether to disable auto healing for the layer.
EnableAutoHealing *bool
// Whether to install operating system and package updates when the instance
// boots. The default value is true . To control when updates are installed, set
// this value to false . You must then update your instances manually by using
// CreateDeployment to run the update_dependencies stack command or by manually
// running yum (Amazon Linux) or apt-get (Ubuntu) on the instances. To ensure that
// your instances have the latest security updates, we strongly recommend using the
// default value of true .
InstallUpdatesOnBoot *bool
// A LifeCycleEventConfiguration object that you can use to configure the Shutdown
// event to specify an execution timeout and enable or disable Elastic Load
// Balancer connection draining.
LifecycleEventConfiguration *types.LifecycleEventConfiguration
// An array of Package objects that describes the layer packages.
Packages []string
// Whether to use Amazon EBS-optimized instances.
UseEbsOptimizedInstances *bool
// A VolumeConfigurations object that describes the layer's Amazon EBS volumes.
VolumeConfigurations []types.VolumeConfiguration
noSmithyDocumentSerde
}
// Contains the response to a CreateLayer request.
type CreateLayerOutput struct {
// The layer ID.
LayerId *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateLayerMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateLayer{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateLayer{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "CreateLayer"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpCreateLayerValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateLayer(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateLayer(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "CreateLayer",
}
}
|