From cda2abca5d3899a9835b9fb460bc6498d7a86cbb Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Tue, 5 Oct 2021 15:20:33 +0530 Subject: [PATCH 01/18] rbd: use NewMetricsBlock to get size instead of lsblk command use NewMetricsBlock function from the kubernetes package to get the size. Signed-off-by: Madhu Rajanna --- internal/rbd/nodeserver.go | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/internal/rbd/nodeserver.go b/internal/rbd/nodeserver.go index b90163e54..793fcf62d 100644 --- a/internal/rbd/nodeserver.go +++ b/internal/rbd/nodeserver.go @@ -33,6 +33,7 @@ import ( "github.com/container-storage-interface/spec/lib/go/csi" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "k8s.io/kubernetes/pkg/volume" mount "k8s.io/mount-utils" utilexec "k8s.io/utils/exec" ) @@ -1140,18 +1141,10 @@ func (ns *NodeServer) NodeGetVolumeStats( // // TODO: https://github.com/container-storage-interface/spec/issues/371#issuecomment-756834471 func blockNodeGetVolumeStats(ctx context.Context, targetPath string) (*csi.NodeGetVolumeStatsResponse, error) { - args := []string{"--noheadings", "--bytes", "--output=SIZE", targetPath} - lsblkSize, _, err := util.ExecCommand(ctx, "/bin/lsblk", args...) + mp := volume.NewMetricsBlock(targetPath) + m, err := mp.GetMetrics() if err != nil { - err = fmt.Errorf("lsblk %v returned an error: %w", args, err) - log.ErrorLog(ctx, err.Error()) - - return nil, status.Error(codes.Internal, err.Error()) - } - - size, err := strconv.ParseInt(strings.TrimSpace(lsblkSize), 10, 64) - if err != nil { - err = fmt.Errorf("failed to convert %q to bytes: %w", lsblkSize, err) + err = fmt.Errorf("failed to get metrics: %w", err) log.ErrorLog(ctx, err.Error()) return nil, status.Error(codes.Internal, err.Error()) @@ -1160,7 +1153,7 @@ func blockNodeGetVolumeStats(ctx context.Context, targetPath string) (*csi.NodeG return &csi.NodeGetVolumeStatsResponse{ Usage: []*csi.VolumeUsage{ { - Total: size, + Total: m.Capacity.Value(), Unit: csi.VolumeUsage_BYTES, }, }, From fe9020260d682840eb21546a952646fa25b57b82 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Tue, 5 Oct 2021 15:23:08 +0530 Subject: [PATCH 02/18] rbd: move flattening to helper function in NodeStage operation we are flattening the image to support mounting on the older clients. this commits moves it to a helper function to reduce code complexity. Signed-off-by: Madhu Rajanna --- internal/rbd/nodeserver.go | 63 +++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/internal/rbd/nodeserver.go b/internal/rbd/nodeserver.go index 793fcf62d..9a993f1b9 100644 --- a/internal/rbd/nodeserver.go +++ b/internal/rbd/nodeserver.go @@ -386,8 +386,6 @@ func (ns *NodeServer) stageTransaction( var err error var readOnly bool - var feature bool - var depth uint var cr *util.Credentials cr, err = util.NewUserCredentials(req.GetSecrets()) @@ -403,29 +401,11 @@ func (ns *NodeServer) stageTransaction( volOptions.readOnly = true } - if kernelRelease == "" { - // fetch the current running kernel info - kernelRelease, err = util.GetKernelVersion() - if err != nil { - return transaction, err - } - } - if !util.CheckKernelSupport(kernelRelease, deepFlattenSupport) && !skipForceFlatten { - feature, err = volOptions.checkImageChainHasFeature(ctx, librbd.FeatureDeepFlatten) - if err != nil { - return transaction, err - } - depth, err = volOptions.getCloneDepth(ctx) - if err != nil { - return transaction, err - } - if feature || depth != 0 { - err = volOptions.flattenRbdImage(ctx, cr, true, rbdHardMaxCloneDepth, rbdSoftMaxCloneDepth) - if err != nil { - return transaction, err - } - } + err = flattenImageBeforeMapping(ctx, volOptions, cr) + if err != nil { + return transaction, err } + // Mapping RBD image var devicePath string devicePath, err = attachRBDImage(ctx, volOptions, devicePath, cr) @@ -481,6 +461,41 @@ func (ns *NodeServer) stageTransaction( return transaction, err } +func flattenImageBeforeMapping( + ctx context.Context, + volOptions *rbdVolume, + cr *util.Credentials) error { + var err error + var feature bool + var depth uint + + if kernelRelease == "" { + // fetch the current running kernel info + kernelRelease, err = util.GetKernelVersion() + if err != nil { + return err + } + } + if !util.CheckKernelSupport(kernelRelease, deepFlattenSupport) && !skipForceFlatten { + feature, err = volOptions.checkImageChainHasFeature(ctx, librbd.FeatureDeepFlatten) + if err != nil { + return err + } + depth, err = volOptions.getCloneDepth(ctx) + if err != nil { + return err + } + if feature || depth != 0 { + err = volOptions.flattenRbdImage(ctx, cr, true, rbdHardMaxCloneDepth, rbdSoftMaxCloneDepth) + if err != nil { + return err + } + } + } + + return nil +} + func (ns *NodeServer) undoStagingTransaction( ctx context.Context, req *csi.NodeStageVolumeRequest, From 8ebc0659ab706f1b033876327d2b5c96dc74d9c5 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Tue, 5 Oct 2021 15:31:35 +0530 Subject: [PATCH 03/18] rbd: perform resize of file system for static volume For static volume, the user will manually mounts already existing image as a volume to the application pods. As its a rbd Image, if the PVC is of type fileSystem the image will be mapped, formatted and mounted on the node, If the user resizes the image on the ceph cluster. User cannot not automatically resize the filesystem created on the rbd image. Even if deletes and recreates the kubernetes objects, the new size will not be visible on the node. With this changes During the NodeStageVolumeRequest the nodeplugin will check the size of the mapped rbd image on the node using the devicePath. and also the rbd image size on the ceph cluster. If the size is not matching it will do the file system resize on the node as part of the NodeStageVolumeRequest RPC call. The user need to do below operation to see new size * Resize the rbd image in ceph cluster * Scale down all the application pods using the static PVC. * Make sure no application pods which are using the static PVC is running on a node. * Scale up all the application pods. Validate the new size in application pod mounted volume. Signed-off-by: Madhu Rajanna --- docs/static-pvc.md | 21 +++++++++++++++++ e2e/staticpvc.go | 47 ++++++++++++++++++++++++++++++++++++++ internal/rbd/nodeserver.go | 20 ++++++++++++++++ 3 files changed, 88 insertions(+) diff --git a/docs/static-pvc.md b/docs/static-pvc.md index 2b1f74f27..82e3ccda2 100644 --- a/docs/static-pvc.md +++ b/docs/static-pvc.md @@ -6,6 +6,7 @@ - [Create RBD static PV](#create-rbd-static-pv) - [RBD Volume Attributes in PV](#rbd-volume-attributes-in-pv) - [Create RBD static PVC](#create-rbd-static-pvc) + - [Resize RBD image](#resize-rbd-image) - [CephFS static PVC](#cephfs-static-pvc) - [Create CephFS subvolume](#create-cephfs-subvolume) - [Create CephFS static PV](#create-cephfs-static-pv) @@ -124,6 +125,26 @@ $ kubectl create -f fs-static-pvc.yaml persistentvolumeclaim/fs-static-pvc created ``` +### Resize RBD image + +Let us resize the RBD image in ceph cluster + +```console +rbd resize static-image --size=2048 --pool=replicapool +``` + +Once the rbd image is resized in the ceph cluster, update the PV size and PVC +size to match the size of the rbd image. + +Now scale down the application pod which is using `cephfs-static-pvc` and scale +up the application pod to resize the filesystem. + +**Note** If you have mounted same static PVC to multiple application pods, make +sure you will scale down all the application pods and make sure no application +pods using the static PVC is running on the node and scale up all the +application pods again(this will trigger `NodeStageVolumeRequest` which will +resize the filesystem for static volume). + **Note** deleting PV and PVC does not removed the backend rbd image, user need to manually delete the rbd image if required diff --git a/e2e/staticpvc.go b/e2e/staticpvc.go index 0bccae778..c428e51d2 100644 --- a/e2e/staticpvc.go +++ b/e2e/staticpvc.go @@ -14,6 +14,7 @@ import ( const ( staticPVSize = "4Gi" + staticPVNewSize = "8Gi" staticPVImageFeature = "layering" monsPrefix = "mons-" imagePrefix = "image-" @@ -175,6 +176,11 @@ func validateRBDStaticPV(f *framework.Framework, appPath string, isBlock, checkI return err } + app.Labels = make(map[string]string) + app.Labels[appKey] = appLabel + appOpt := metav1.ListOptions{ + LabelSelector: fmt.Sprintf("%s=%s", appKey, appLabel), + } app.Namespace = namespace app.Spec.Volumes[0].PersistentVolumeClaim.ClaimName = pvcName if checkImgFeat { @@ -191,6 +197,14 @@ func validateRBDStaticPV(f *framework.Framework, appPath string, isBlock, checkI return err } + // resize image only if the image is already mounted and formatted + if !checkImgFeat { + err = validateRBDStaticResize(f, app, &appOpt, pvc, rbdImageName) + if err != nil { + return err + } + } + err = c.CoreV1().PersistentVolumeClaims(pvc.Namespace).Delete(context.TODO(), pvc.Name, metav1.DeleteOptions{}) if err != nil { return fmt.Errorf("failed to delete pvc: %w", err) @@ -473,3 +487,36 @@ func validateCephFsStaticPV(f *framework.Framework, appPath, scPath string) erro return nil } + +func validateRBDStaticResize( + f *framework.Framework, + app *v1.Pod, + appOpt *metav1.ListOptions, + pvc *v1.PersistentVolumeClaim, + rbdImageName string) error { + // resize rbd image + size := staticPVNewSize + cmd := fmt.Sprintf( + "rbd resize %s --size=%s %s", + rbdImageName, + size, + rbdOptions(defaultRBDPool)) + + _, _, err := execCommandInToolBoxPod(f, cmd, rookNamespace) + if err != nil { + return err + } + err = createApp(f.ClientSet, app, deployTimeout) + if err != nil { + return err + } + // check size for the filesystem type PVC + if *pvc.Spec.VolumeMode == v1.PersistentVolumeFilesystem { + err = checkDirSize(app, f, appOpt, size) + if err != nil { + return err + } + } + + return deletePod(app.Name, app.Namespace, f.ClientSet, deployTimeout) +} diff --git a/internal/rbd/nodeserver.go b/internal/rbd/nodeserver.go index 9a993f1b9..96d94de52 100644 --- a/internal/rbd/nodeserver.go +++ b/internal/rbd/nodeserver.go @@ -453,6 +453,26 @@ func (ns *NodeServer) stageTransaction( } transaction.isMounted = true + // resize if its fileSystemType static volume. + if staticVol && !isBlock { + var ok bool + resizer := mount.NewResizeFs(utilexec.New()) + ok, err = resizer.NeedResize(devicePath, stagingTargetPath) + if err != nil { + return transaction, status.Errorf(codes.Internal, + "Need resize check failed on devicePath %s and staingPath %s, error: %v", + devicePath, + stagingTargetPath, + err) + } + if ok { + ok, err = resizer.Resize(devicePath, stagingTargetPath) + if !ok { + return transaction, status.Errorf(codes.Internal, + "resize failed on path %s, error: %v", stagingTargetPath, err) + } + } + } if !readOnly { // #nosec - allow anyone to write inside the target path err = os.Chmod(stagingTargetPath, 0o777) From b9beb2106b70f10d94c8e491a6feb340a4511df4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Oct 2021 11:43:49 +0000 Subject: [PATCH 04/18] rebase: bump github.com/aws/aws-sdk-go from 1.40.50 to 1.40.55 Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.40.50 to 1.40.55. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.40.50...v1.40.55) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +- .../aws/aws-sdk-go/aws/endpoints/defaults.go | 134 +++++++++++++++++- .../github.com/aws/aws-sdk-go/aws/version.go | 2 +- .../aws/aws-sdk-go/service/kms/api.go | 3 +- vendor/modules.txt | 2 +- 6 files changed, 136 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index ae278800b..c7790e9cc 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/ceph/ceph-csi go 1.16 require ( - github.com/aws/aws-sdk-go v1.40.50 + github.com/aws/aws-sdk-go v1.40.55 github.com/ceph/ceph-csi/api v0.0.0-00010101000000-000000000000 github.com/ceph/go-ceph v0.11.0 github.com/container-storage-interface/spec v1.5.0 diff --git a/go.sum b/go.sum index 7f1a6b9d0..1839d3948 100644 --- a/go.sum +++ b/go.sum @@ -133,8 +133,8 @@ github.com/aws/aws-sdk-go v1.25.41/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpi github.com/aws/aws-sdk-go v1.30.27/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/aws/aws-sdk-go v1.35.24/go.mod h1:tlPOdRjfxPBpNIwqDj61rmsnA85v9jc0Ps9+muhnW+k= github.com/aws/aws-sdk-go v1.38.49/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= -github.com/aws/aws-sdk-go v1.40.50 h1:QP4NC9EZWBszbNo2UbG6bbObMtN35kCFb4h0r08q884= -github.com/aws/aws-sdk-go v1.40.50/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= +github.com/aws/aws-sdk-go v1.40.55 h1:l5xNBmafEAfdJIIe32QbTLG3j/JscH8fzZqYyMlntuI= +github.com/aws/aws-sdk-go v1.40.55/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go index df4719472..4de91f08c 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -237,6 +237,19 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "account": service{ + PartitionEndpoint: "aws-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-global": endpoint{ + Hostname: "account.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + }, + }, "acm": service{ Endpoints: endpoints{ @@ -959,11 +972,15 @@ var awsPartition = partition{ Protocols: []string{"https"}, }, Endpoints: endpoints{ - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, + "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, }, }, "athena": service{ @@ -1241,6 +1258,62 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "cloudcontrolapi": service{ + + Endpoints: endpoints{ + "af-south-1": endpoint{}, + "ap-east-1": endpoint{}, + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, + "eu-south-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "fips-ca-central-1": endpoint{ + Hostname: "cloudcontrolapi-fips.ca-central-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ca-central-1", + }, + }, + "fips-us-east-1": endpoint{ + Hostname: "cloudcontrolapi-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "fips-us-east-2": endpoint{ + Hostname: "cloudcontrolapi-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "fips-us-west-1": endpoint{ + Hostname: "cloudcontrolapi-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "fips-us-west-2": endpoint{ + Hostname: "cloudcontrolapi-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + "me-south-1": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "clouddirectory": service{ Endpoints: endpoints{ @@ -3934,6 +4007,7 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, @@ -3959,6 +4033,12 @@ var awsPartition = partition{ Region: "ap-northeast-2", }, }, + "ap-south-1": endpoint{ + Hostname: "data.iotevents.ap-south-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-south-1", + }, + }, "ap-southeast-1": endpoint{ Hostname: "data.iotevents.ap-southeast-1.amazonaws.com", CredentialScope: credentialScope{ @@ -7640,6 +7720,18 @@ var awsPartition = partition{ }, }, }, + "voiceid": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "waf": service{ PartitionEndpoint: "aws-global", IsRegionalized: boxedFalse, @@ -8067,6 +8159,19 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "account": service{ + PartitionEndpoint: "aws-cn-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-cn-global": endpoint{ + Hostname: "account.cn-northwest-1.amazonaws.com.cn", + CredentialScope: credentialScope{ + Region: "cn-northwest-1", + }, + }, + }, + }, "acm": service{ Endpoints: endpoints{ @@ -9278,6 +9383,25 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, + "cloudcontrolapi": service{ + + Endpoints: endpoints{ + "fips-us-gov-east-1": endpoint{ + Hostname: "cloudcontrolapi-fips.us-gov-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-east-1", + }, + }, + "fips-us-gov-west-1": endpoint{ + Hostname: "cloudcontrolapi-fips.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, "clouddirectory": service{ Endpoints: endpoints{ diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go index be47f9b24..80752a429 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.40.50" +const SDKVersion = "1.40.55" diff --git a/vendor/github.com/aws/aws-sdk-go/service/kms/api.go b/vendor/github.com/aws/aws-sdk-go/service/kms/api.go index aef79ed9d..a55357d29 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/kms/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/kms/api.go @@ -7057,7 +7057,8 @@ func (c *KMS) UpdateCustomKeyStoreRequest(input *UpdateCustomKeyStoreInput) (req // the connection state of a custom key store, use the DescribeCustomKeyStores // operation. // -// Use the parameters of UpdateCustomKeyStore to edit your keystore settings. +// The CustomKeyStoreId parameter is required in all commands. Use the other +// parameters of UpdateCustomKeyStore to edit your key store settings. // // * Use the NewCustomKeyStoreName parameter to change the friendly name // of the custom key store to the value that you specify. diff --git a/vendor/modules.txt b/vendor/modules.txt index 6a67e0e88..ebbf320f8 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,4 +1,4 @@ -# github.com/aws/aws-sdk-go v1.40.50 +# github.com/aws/aws-sdk-go v1.40.55 ## explicit github.com/aws/aws-sdk-go/aws github.com/aws/aws-sdk-go/aws/awserr From 90ecd2d7e84449288529b2884164b612c26b106c Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Thu, 7 Oct 2021 10:27:17 +0530 Subject: [PATCH 05/18] rbd: use go-ceph to get mirroring info use go-ceph api to get image mirroring info. closes #2558 Signed-off-by: Madhu Rajanna --- internal/rbd/rbd_util.go | 51 +++------------------------------------- 1 file changed, 3 insertions(+), 48 deletions(-) diff --git a/internal/rbd/rbd_util.go b/internal/rbd/rbd_util.go index 0cc663c54..1f963108d 100644 --- a/internal/rbd/rbd_util.go +++ b/internal/rbd/rbd_util.go @@ -481,12 +481,12 @@ func (rv *rbdVolume) isInUse() (bool, error) { return false, err } - // TODO replace this with logic to get mirroring information once - // https://github.com/ceph/go-ceph/issues/379 is fixed - err = rv.updateVolWithImageInfo() + mirrorInfo, err := image.GetMirrorImageInfo() if err != nil { return false, err } + rv.Primary = mirrorInfo.Primary + // because we opened the image, there is at least one watcher defaultWatchers := 1 if rv.Primary { @@ -1463,51 +1463,6 @@ func (rv *rbdVolume) getImageInfo() error { return nil } -// imageInfo strongly typed JSON spec for image info. -type imageInfo struct { - Mirroring mirroring `json:"mirroring"` -} - -// parentInfo spec for parent volume info. -type mirroring struct { - Primary bool `json:"primary"` -} - -// updateVolWithImageInfo updates provided rbdVolume with information from on-disk data -// regarding the same. -func (rv *rbdVolume) updateVolWithImageInfo() error { - // rbd --format=json info [image-spec | snap-spec] - var imgInfo imageInfo - - stdout, stderr, err := util.ExecCommand( - context.TODO(), - "rbd", - "-m", rv.Monitors, - "--id", rv.conn.Creds.ID, - "--keyfile="+rv.conn.Creds.KeyFile, - "-c", util.CephConfigPath, - "--format="+"json", - "info", rv.String()) - if err != nil { - if strings.Contains(stderr, "rbd: error opening image "+rv.RbdImageName+ - ": (2) No such file or directory") { - return util.JoinErrors(ErrImageNotFound, err) - } - - return err - } - - if stdout != "" { - err = json.Unmarshal([]byte(stdout), &imgInfo) - if err != nil { - return fmt.Errorf("unmarshal failed (%w), raw buffer response: %s", err, stdout) - } - rv.Primary = imgInfo.Mirroring.Primary - } - - return nil -} - /* checkSnapExists queries rbd about the snapshots of the given image and returns ErrImageNotFound if provided image is not found, and ErrSnapNotFound if From a01b9821ee2a3a97533dffd22b8c2e675f3670e2 Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Thu, 30 Sep 2021 12:41:57 +0530 Subject: [PATCH 06/18] e2e: set rbd-nbd mounter tests cephLogStrategy to preserve This is to preserve the rbd-nbd logs post unmap, so that the CI can dump the available logs from logdir. Fixes: #2451 Signed-off-by: Prasanna Kumar Kalever --- e2e/rbd.go | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/e2e/rbd.go b/e2e/rbd.go index b26b4f072..e5fb66380 100644 --- a/e2e/rbd.go +++ b/e2e/rbd.go @@ -60,7 +60,8 @@ var ( snapshotPath = rbdExamplePath + "snapshot.yaml" defaultCloneCount = 10 - nbdMapOptions = "debug-rbd=20" + nbdMapOptions = "debug-rbd=20" + e2eDefaultCephLogStrategy = "preserve" ) func deployRBDPlugin() { @@ -477,8 +478,9 @@ var _ = Describe("RBD", func() { defaultSCName, nil, map[string]string{ - "mounter": "rbd-nbd", - "mapOptions": nbdMapOptions, + "mounter": "rbd-nbd", + "mapOptions": nbdMapOptions, + "cephLogStrategy": e2eDefaultCephLogStrategy, }, deletePolicy) if err != nil { @@ -513,8 +515,9 @@ var _ = Describe("RBD", func() { defaultSCName, nil, map[string]string{ - "mounter": "rbd-nbd", - "mapOptions": nbdMapOptions, + "mounter": "rbd-nbd", + "mapOptions": nbdMapOptions, + "cephLogStrategy": e2eDefaultCephLogStrategy, }, deletePolicy) if err != nil { @@ -558,8 +561,9 @@ var _ = Describe("RBD", func() { defaultSCName, nil, map[string]string{ - "mounter": "rbd-nbd", - "mapOptions": nbdMapOptions, + "mounter": "rbd-nbd", + "mapOptions": nbdMapOptions, + "cephLogStrategy": e2eDefaultCephLogStrategy, }, deletePolicy) if err != nil { @@ -712,9 +716,10 @@ var _ = Describe("RBD", func() { defaultSCName, nil, map[string]string{ - "mounter": "rbd-nbd", - "mapOptions": nbdMapOptions, - "encrypted": "true", + "mounter": "rbd-nbd", + "mapOptions": nbdMapOptions, + "cephLogStrategy": e2eDefaultCephLogStrategy, + "encrypted": "true", }, deletePolicy) if err != nil { @@ -1069,9 +1074,10 @@ var _ = Describe("RBD", func() { defaultSCName, nil, map[string]string{ - "imageFeatures": "layering,journaling,exclusive-lock", - "mounter": "rbd-nbd", - "mapOptions": nbdMapOptions, + "imageFeatures": "layering,journaling,exclusive-lock", + "mounter": "rbd-nbd", + "mapOptions": nbdMapOptions, + "cephLogStrategy": e2eDefaultCephLogStrategy, }, deletePolicy) if err != nil { From 4e61156dc499609b8786abad2be3310ebb4ba5e6 Mon Sep 17 00:00:00 2001 From: Humble Chirammal Date: Fri, 8 Oct 2021 13:55:01 +0530 Subject: [PATCH 07/18] rbd: change iteration variable name in the migration test to be specific we reuse or overload the variable name in the test execution at present. This commit use a different variable name as initialized in each run Signed-off-by: Humble Chirammal --- internal/rbd/migration_test.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/rbd/migration_test.go b/internal/rbd/migration_test.go index a32e0d294..a03f6a57a 100644 --- a/internal/rbd/migration_test.go +++ b/internal/rbd/migration_test.go @@ -54,12 +54,12 @@ func TestIsMigrationVolID(t *testing.T) { }, } for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { + newtt := tt + t.Run(newtt.name, func(t *testing.T) { t.Parallel() - got := isMigrationVolID(tt.args) - if got != tt.migVolID { - t.Errorf("isMigrationVolID() = %v, want %v", got, tt.migVolID) + got := isMigrationVolID(newtt.args) + if got != newtt.migVolID { + t.Errorf("isMigrationVolID() = %v, want %v", got, newtt.migVolID) } }) } @@ -156,17 +156,17 @@ func TestParseMigrationVolID(t *testing.T) { }, } for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { + newtt := tt + t.Run(newtt.name, func(t *testing.T) { t.Parallel() - got, err := parseMigrationVolID(tt.args) - if (err != nil) != tt.wantErr { - t.Errorf("ParseMigrationVolID() error = %v, wantErr %v", err, tt.wantErr) + got, err := parseMigrationVolID(newtt.args) + if (err != nil) != newtt.wantErr { + t.Errorf("ParseMigrationVolID() error = %v, wantErr %v", err, newtt.wantErr) return } - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("ParseMigrationVolID() got = %v, want %v", got, tt.want) + if !reflect.DeepEqual(got, newtt.want) { + t.Errorf("ParseMigrationVolID() got = %v, want %v", got, newtt.want) } }) } From c584fa20da9f024ccde6f40bc48a5fa46d13d13d Mon Sep 17 00:00:00 2001 From: Humble Chirammal Date: Fri, 8 Oct 2021 13:58:04 +0530 Subject: [PATCH 08/18] rbd: use clusterID from volumeContext at nodestage previously we were retriving clusterID using the monitors field in the volume context at node stage code path. however it is possible to retrieve or use clusterID directly from the volume context. This commit also remove the getClusterIDFromMigrationVolume() function which was used previously and its tests Signed-off-by: Humble Chirammal --- internal/rbd/nodeserver.go | 28 --------------------- internal/util/csiconfig.go | 44 --------------------------------- internal/util/csiconfig_test.go | 32 ------------------------ 3 files changed, 104 deletions(-) diff --git a/internal/rbd/nodeserver.go b/internal/rbd/nodeserver.go index 96d94de52..846668e6f 100644 --- a/internal/rbd/nodeserver.go +++ b/internal/rbd/nodeserver.go @@ -150,24 +150,6 @@ func healerStageTransaction(ctx context.Context, cr *util.Credentials, volOps *r return nil } -// getClusterIDFromMigrationVolume fills the clusterID for the passed in monitors. -func getClusterIDFromMigrationVolume(monitors string) (string, error) { - var err error - var rclusterID string - for _, m := range strings.Split(monitors, ",") { - rclusterID, err = util.GetClusterIDFromMon(m) - if err != nil && !errors.Is(err, util.ErrMissingConfigForMonitor) { - return "", err - } - - if rclusterID != "" { - return rclusterID, nil - } - } - - return "", err -} - // populateRbdVol update the fields in rbdVolume struct based on the request it received. func populateRbdVol( ctx context.Context, @@ -291,16 +273,6 @@ func (ns *NodeServer) NodeStageVolume( } defer ns.VolumeLocks.Release(volID) - // Check this is a migration request because in that case, unlike other node stage requests - // it will be missing the clusterID, so fill it by fetching it from config file using mon. - if req.GetVolumeContext()[intreeMigrationKey] == intreeMigrationLabel && req.VolumeContext[util.ClusterIDKey] == "" { - cID, cErr := getClusterIDFromMigrationVolume(req.GetVolumeContext()["monitors"]) - if cErr != nil { - return nil, status.Error(codes.Internal, cErr.Error()) - } - req.VolumeContext[util.ClusterIDKey] = cID - } - stagingParentPath := req.GetStagingTargetPath() stagingTargetPath := stagingParentPath + "/" + volID diff --git a/internal/util/csiconfig.go b/internal/util/csiconfig.go index 6e45d04a6..874ff5269 100644 --- a/internal/util/csiconfig.go +++ b/internal/util/csiconfig.go @@ -161,47 +161,3 @@ func GetClusterID(options map[string]string) (string, error) { return clusterID, nil } - -// GetClusterIDFromMon will be called with a mon string to fetch -// clusterID based on the passed in mon string. If passed in 'mon' -// string has been found in the config the clusterID is returned, -// else error. -func GetClusterIDFromMon(mon string) (string, error) { - clusterID, err := readClusterInfoWithMon(CsiConfigFile, mon) - - return clusterID, err -} - -func readClusterInfoWithMon(pathToConfig, mon string) (string, error) { - var config []ClusterInfo - - // #nosec - content, err := ioutil.ReadFile(pathToConfig) - if err != nil { - err = fmt.Errorf("error fetching configuration file %q: %w", pathToConfig, err) - - return "", err - } - - err = json.Unmarshal(content, &config) - if err != nil { - return "", fmt.Errorf("unmarshal failed (%w), raw buffer response: %s", - err, string(content)) - } - - for _, cluster := range config { - // as the same mons can fall into different clusterIDs with - // different radosnamespace configurations, we are bailing out - // if radosnamespace configuration is found for this cluster - if cluster.RadosNamespace != "" { - continue - } - for _, m := range cluster.Monitors { - if m == mon { - return cluster.ClusterID, nil - } - } - } - - return "", ErrMissingConfigForMonitor -} diff --git a/internal/util/csiconfig_test.go b/internal/util/csiconfig_test.go index cdd199cdd..a946dd76c 100644 --- a/internal/util/csiconfig_test.go +++ b/internal/util/csiconfig_test.go @@ -34,7 +34,6 @@ func cleanupTestData() { os.RemoveAll(basePath) } -// nolint:gocyclo,cyclop // TODO: make this function less complex. func TestCSIConfig(t *testing.T) { t.Parallel() var err error @@ -139,35 +138,4 @@ func TestCSIConfig(t *testing.T) { if err != nil { t.Errorf("Test setup error %s", err) } - - // TEST: Should pass as clusterID is present in config - content, err = readClusterInfoWithMon(pathToConfig, "mon1") - if err != nil || content != "test2" { - t.Errorf("Failed: want (%s), got (%s) (%v)", "test2", content, err) - } - - // TEST: Should pass as clusterID is present in config - content, err = readClusterInfoWithMon(pathToConfig, "mon5") - if err != nil || content != "test1" { - t.Errorf("Failed: want (%s), got (%s) (%v)", "test1", content, err) - } - - // TEST: Should fail as clusterID is not present in config - content, err = readClusterInfoWithMon(pathToConfig, "mon8") - if err == nil { - t.Errorf("Failed: got (%s)", content) - } - - data = "[{\"clusterID\":\"" + clusterID2 + "\", \"radosNamespace\": \"ns1\", \"monitors\":[\"mon1\"]}," + - "{\"clusterID\":\"" + clusterID1 + "\",\"monitors\":[\"mon1\"]}]" - err = ioutil.WriteFile(basePath+"/"+csiClusters, []byte(data), 0o600) - if err != nil { - t.Errorf("Test setup error %s", err) - } - - // TEST: Should pass as clusterID is present in config - content, err = readClusterInfoWithMon(pathToConfig, "mon1") - if err != nil || content != clusterID1 { - t.Errorf("Failed: want (%s), got (%s) (%v)", "test2", content, err) - } } From 819f4f90487e62d94f319abc06c98080ac00c72b Mon Sep 17 00:00:00 2001 From: Humble Chirammal Date: Fri, 8 Oct 2021 14:01:33 +0530 Subject: [PATCH 09/18] e2e: adjust migration tests to use clusterID in the volume context Signed-off-by: Humble Chirammal --- e2e/migration.go | 32 +++++++++++++++++++++++++++++- e2e/rbd.go | 51 ++++++++++++++++++++++++++++-------------------- e2e/staticpvc.go | 2 +- 3 files changed, 62 insertions(+), 23 deletions(-) diff --git a/e2e/migration.go b/e2e/migration.go index c2bad637e..ddeaeaf8b 100644 --- a/e2e/migration.go +++ b/e2e/migration.go @@ -8,6 +8,7 @@ import ( "strings" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes" "k8s.io/kubernetes/test/e2e/framework" ) @@ -48,7 +49,7 @@ func validateRBDStaticMigrationPVDeletion(f *framework.Framework, appPath, scNam } opt["migration"] = "true" - opt["monitors"] = mon + opt["clusterID"] = getMonsHash(mon) opt["imageFeatures"] = staticPVImageFeature opt["pool"] = defaultRBDPool opt["staticVolume"] = strconv.FormatBool(true) @@ -114,3 +115,32 @@ func composeIntreeMigVolID(mons, rbdImageName string) string { return strings.Join(vhSlice, "_") } + +// generateClusterIDConfigMapForMigration retrieve monitors and generate a hash value which +// is used as a clusterID in the custom configmap, this function also recreate RBD CSI pods +// once the custom config map has been recreated. +func generateClusterIDConfigMapForMigration(f *framework.Framework, c kubernetes.Interface) error { + // create monitors hash by fetching monitors from the cluster. + mons, err := getMons(rookNamespace, c) + if err != nil { + return fmt.Errorf("failed to get monitors %w", err) + } + mon := strings.Join(mons, ",") + inClusterID := getMonsHash(mon) + + clusterInfo := map[string]map[string]string{} + clusterInfo[inClusterID] = map[string]string{} + + // create custom configmap + err = createCustomConfigMap(f.ClientSet, rbdDirPath, clusterInfo) + if err != nil { + return fmt.Errorf("failed to create configmap with error %w", err) + } + // restart csi pods for the configmap to take effect. + err = recreateCSIRBDPods(f) + if err != nil { + return fmt.Errorf("failed to recreate rbd csi pods with error %w", err) + } + + return nil +} diff --git a/e2e/rbd.go b/e2e/rbd.go index e5fb66380..8fcac8228 100644 --- a/e2e/rbd.go +++ b/e2e/rbd.go @@ -367,32 +367,17 @@ var _ = Describe("RBD", func() { } }) } + // todo: may be remove the below deletion test later once the migration nodestage tests are adjusted + // also to have deletion validation through the same. By("validate RBD migration+static Block PVC Deletion", func() { - // create monitors hash by fetching monitors from the cluster. - mons, err := getMons(rookNamespace, c) + err := generateClusterIDConfigMapForMigration(f, c) if err != nil { - e2elog.Failf("failed to get monitors %v", err) - } - mon := strings.Join(mons, ",") - inClusterID := getMonsHash(mon) - - clusterInfo := map[string]map[string]string{} - clusterInfo[inClusterID] = map[string]string{} - - // create custom configmap - err = createCustomConfigMap(f.ClientSet, rbdDirPath, clusterInfo) - if err != nil { - e2elog.Failf("failed to create configmap with error %v", err) + e2elog.Failf("failed to generate clusterID configmap with error %v", err) } err = createRBDStorageClass(f.ClientSet, f, "migrationsc", nil, nil, deletePolicy) if err != nil { e2elog.Failf("failed to create storageclass with error %v", err) } - // restart csi pods for the configmap to take effect. - err = recreateCSIRBDPods(f) - if err != nil { - e2elog.Failf("failed to recreate rbd csi pods with error %v", err) - } err = validateRBDStaticMigrationPVDeletion(f, rawAppPath, "migrationsc", true) if err != nil { e2elog.Failf("failed to validate rbd migrated static block pv with error %v", err) @@ -1617,21 +1602,45 @@ var _ = Describe("RBD", func() { }) By("validate RBD migration+static FileSystem PVC", func() { - err := validateRBDStaticMigrationPV(f, appPath, false) + err := generateClusterIDConfigMapForMigration(f, c) + if err != nil { + e2elog.Failf("failed to generate clusterID configmap with error %v", err) + } + err = validateRBDStaticMigrationPV(f, appPath, false) if err != nil { e2elog.Failf("failed to validate rbd migrated static pv with error %v", err) } // validate created backend rbd images validateRBDImageCount(f, 0, defaultRBDPool) + err = deleteConfigMap(rbdDirPath) + if err != nil { + e2elog.Failf("failed to delete configmap with error %v", err) + } + err = createConfigMap(rbdDirPath, f.ClientSet, f) + if err != nil { + e2elog.Failf("failed to create configmap with error %v", err) + } }) By("validate RBD migration+static Block PVC", func() { - err := validateRBDStaticMigrationPV(f, rawAppPath, true) + err := generateClusterIDConfigMapForMigration(f, c) + if err != nil { + e2elog.Failf("failed to generate clusterID configmap with error %v", err) + } + err = validateRBDStaticMigrationPV(f, rawAppPath, true) if err != nil { e2elog.Failf("failed to validate rbd migrated static block pv with error %v", err) } // validate created backend rbd images validateRBDImageCount(f, 0, defaultRBDPool) + err = deleteConfigMap(rbdDirPath) + if err != nil { + e2elog.Failf("failed to delete configmap with error %v", err) + } + err = createConfigMap(rbdDirPath, f.ClientSet, f) + if err != nil { + e2elog.Failf("failed to create configmap with error %v", err) + } }) By("validate failure of RBD static PVC without imageFeatures parameter", func() { diff --git a/e2e/staticpvc.go b/e2e/staticpvc.go index c428e51d2..3ef2c96c5 100644 --- a/e2e/staticpvc.go +++ b/e2e/staticpvc.go @@ -256,7 +256,7 @@ func validateRBDStaticMigrationPV(f *framework.Framework, appPath string, isBloc } opt["migration"] = "true" - opt["monitors"] = mon + opt["clusterID"] = getMonsHash(mon) opt["imageFeatures"] = staticPVImageFeature opt["pool"] = defaultRBDPool opt["staticVolume"] = strconv.FormatBool(true) From 574852e27c84b8ac78ad7412b0f8ca300eb2bb4b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Oct 2021 20:29:57 +0000 Subject: [PATCH 10/18] rebase: bump github.com/aws/aws-sdk-go from 1.40.55 to 1.41.0 Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.40.55 to 1.41.0. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.40.55...v1.41.0) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +- .../aws/aws-sdk-go/aws/endpoints/defaults.go | 205 ++ .../github.com/aws/aws-sdk-go/aws/version.go | 2 +- .../private/protocol/json/jsonutil/build.go | 10 +- .../private/protocol/jsonrpc/jsonrpc.go | 5 +- .../private/protocol/rest/payload.go | 11 +- .../aws/aws-sdk-go/service/ec2/api.go | 1991 +++++++++++++++-- .../aws/aws-sdk-go/service/ec2/waiters.go | 5 + .../aws/aws-sdk-go/service/sso/api.go | 10 +- vendor/modules.txt | 2 +- 11 files changed, 2079 insertions(+), 168 deletions(-) diff --git a/go.mod b/go.mod index c7790e9cc..f56e2d115 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/ceph/ceph-csi go 1.16 require ( - github.com/aws/aws-sdk-go v1.40.55 + github.com/aws/aws-sdk-go v1.41.0 github.com/ceph/ceph-csi/api v0.0.0-00010101000000-000000000000 github.com/ceph/go-ceph v0.11.0 github.com/container-storage-interface/spec v1.5.0 diff --git a/go.sum b/go.sum index 1839d3948..f45c5fcd9 100644 --- a/go.sum +++ b/go.sum @@ -133,8 +133,8 @@ github.com/aws/aws-sdk-go v1.25.41/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpi github.com/aws/aws-sdk-go v1.30.27/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/aws/aws-sdk-go v1.35.24/go.mod h1:tlPOdRjfxPBpNIwqDj61rmsnA85v9jc0Ps9+muhnW+k= github.com/aws/aws-sdk-go v1.38.49/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= -github.com/aws/aws-sdk-go v1.40.55 h1:l5xNBmafEAfdJIIe32QbTLG3j/JscH8fzZqYyMlntuI= -github.com/aws/aws-sdk-go v1.40.55/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= +github.com/aws/aws-sdk-go v1.41.0 h1:XUzHLFWQVhmFtmKTodnAo5QdooPQfpVfilCxIV3aLoE= +github.com/aws/aws-sdk-go v1.41.0/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go index 4de91f08c..510f68060 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -2075,6 +2075,30 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "databrew": service{ + + Endpoints: endpoints{ + "af-south-1": endpoint{}, + "ap-east-1": endpoint{}, + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, + "eu-south-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "dataexchange": service{ Endpoints: endpoints{ @@ -3695,6 +3719,71 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "grafana": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{ + Hostname: "grafana.ap-northeast-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-northeast-1", + }, + }, + "ap-northeast-2": endpoint{ + Hostname: "grafana.ap-northeast-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-northeast-2", + }, + }, + "ap-southeast-1": endpoint{ + Hostname: "grafana.ap-southeast-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-southeast-1", + }, + }, + "ap-southeast-2": endpoint{ + Hostname: "grafana.ap-southeast-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-southeast-2", + }, + }, + "eu-central-1": endpoint{ + Hostname: "grafana.eu-central-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-central-1", + }, + }, + "eu-west-1": endpoint{ + Hostname: "grafana.eu-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-west-1", + }, + }, + "eu-west-2": endpoint{ + Hostname: "grafana.eu-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-west-2", + }, + }, + "us-east-1": endpoint{ + Hostname: "grafana.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoint{ + Hostname: "grafana.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-west-2": endpoint{ + Hostname: "grafana.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + }, + }, "greengrass": service{ IsRegionalized: boxedTrue, Defaults: endpoint{ @@ -4245,6 +4334,36 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "kendra": service{ + + Endpoints: endpoints{ + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "fips-us-east-1": endpoint{ + Hostname: "kendra-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "fips-us-east-2": endpoint{ + Hostname: "kendra-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "fips-us-west-2": endpoint{ + Hostname: "kendra-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "kinesis": service{ Endpoints: endpoints{ @@ -5314,6 +5433,12 @@ var awsPartition = partition{ Region: "eu-west-3", }, }, + "sa-east-1": endpoint{ + Hostname: "oidc.sa-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "sa-east-1", + }, + }, "us-east-1": endpoint{ Hostname: "oidc.us-east-1.amazonaws.com", CredentialScope: credentialScope{ @@ -7536,6 +7661,54 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "textract": service{ + + Endpoints: endpoints{ + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "fips-ca-central-1": endpoint{ + Hostname: "textract-fips.ca-central-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ca-central-1", + }, + }, + "fips-us-east-1": endpoint{ + Hostname: "textract-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "fips-us-east-2": endpoint{ + Hostname: "textract-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "fips-us-west-1": endpoint{ + Hostname: "textract-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "fips-us-west-2": endpoint{ + Hostname: "textract-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "transcribe": service{ Defaults: endpoint{ Protocols: []string{"https"}, @@ -8373,6 +8546,13 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "databrew": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, "dax": service{ Endpoints: endpoints{ @@ -9616,6 +9796,12 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, + "databrew": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "datasync": service{ Endpoints: endpoints{ @@ -11055,6 +11241,25 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, + "textract": service{ + + Endpoints: endpoints{ + "fips-us-gov-east-1": endpoint{ + Hostname: "textract-fips.us-gov-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-east-1", + }, + }, + "fips-us-gov-west-1": endpoint{ + Hostname: "textract-fips.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, "transcribe": service{ Defaults: endpoint{ Protocols: []string{"https"}, diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go index 80752a429..4a04d190b 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.40.55" +const SDKVersion = "1.41.0" diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go index 864fb6704..2aec80661 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go @@ -82,13 +82,17 @@ func buildStruct(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) field, _ := value.Type().FieldByName(payload) tag = field.Tag value = elemOf(value.FieldByName(payload)) - - if !value.IsValid() { + if !value.IsValid() && tag.Get("type") != "structure" { return nil } } buf.WriteByte('{') + defer buf.WriteString("}") + + if !value.IsValid() { + return nil + } t := value.Type() first := true @@ -144,8 +148,6 @@ func buildStruct(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) } - buf.WriteString("}") - return nil } diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go index a029217e4..d9aa27114 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go @@ -49,9 +49,8 @@ func Build(req *request.Request) { buf = emptyJSON } - if req.ClientInfo.TargetPrefix != "" || string(buf) != "{}" { - req.SetBufferBody(buf) - } + // Always serialize the body, don't suppress it. + req.SetBufferBody(buf) if req.ClientInfo.TargetPrefix != "" { target := req.ClientInfo.TargetPrefix + "." + req.Operation.Name diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go index 4366de2e1..b54c99eda 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go @@ -28,18 +28,27 @@ func PayloadMember(i interface{}) interface{} { return nil } -// PayloadType returns the type of a payload field member of i if there is one, or "". +const nopayloadPayloadType = "nopayload" + +// PayloadType returns the type of a payload field member of i if there is one, +// or "". func PayloadType(i interface{}) string { v := reflect.Indirect(reflect.ValueOf(i)) if !v.IsValid() { return "" } + if field, ok := v.Type().FieldByName("_"); ok { + if noPayload := field.Tag.Get(nopayloadPayloadType); noPayload != "" { + return nopayloadPayloadType + } + if payloadName := field.Tag.Get("payload"); payloadName != "" { if member, ok := v.Type().FieldByName(payloadName); ok { return member.Tag.Get("type") } } } + return "" } diff --git a/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go index 7422b5a44..91b9d92b0 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go @@ -2907,6 +2907,89 @@ func (c *EC2) CancelCapacityReservationWithContext(ctx aws.Context, input *Cance return out, req.Send() } +const opCancelCapacityReservationFleets = "CancelCapacityReservationFleets" + +// CancelCapacityReservationFleetsRequest generates a "aws/request.Request" representing the +// client's request for the CancelCapacityReservationFleets operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CancelCapacityReservationFleets for more information on using the CancelCapacityReservationFleets +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the CancelCapacityReservationFleetsRequest method. +// req, resp := client.CancelCapacityReservationFleetsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CancelCapacityReservationFleets +func (c *EC2) CancelCapacityReservationFleetsRequest(input *CancelCapacityReservationFleetsInput) (req *request.Request, output *CancelCapacityReservationFleetsOutput) { + op := &request.Operation{ + Name: opCancelCapacityReservationFleets, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CancelCapacityReservationFleetsInput{} + } + + output = &CancelCapacityReservationFleetsOutput{} + req = c.newRequest(op, input, output) + return +} + +// CancelCapacityReservationFleets API operation for Amazon Elastic Compute Cloud. +// +// Cancels one or more Capacity Reservation Fleets. When you cancel a Capacity +// Reservation Fleet, the following happens: +// +// * The Capacity Reservation Fleet's status changes to cancelled. +// +// * The individual Capacity Reservations in the Fleet are cancelled. Instances +// running in the Capacity Reservations at the time of cancelling the Fleet +// continue to run in shared capacity. +// +// * The Fleet stops creating new Capacity Reservations. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation CancelCapacityReservationFleets for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CancelCapacityReservationFleets +func (c *EC2) CancelCapacityReservationFleets(input *CancelCapacityReservationFleetsInput) (*CancelCapacityReservationFleetsOutput, error) { + req, out := c.CancelCapacityReservationFleetsRequest(input) + return out, req.Send() +} + +// CancelCapacityReservationFleetsWithContext is the same as CancelCapacityReservationFleets with the addition of +// the ability to pass a context and additional request options. +// +// See CancelCapacityReservationFleets for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) CancelCapacityReservationFleetsWithContext(ctx aws.Context, input *CancelCapacityReservationFleetsInput, opts ...request.Option) (*CancelCapacityReservationFleetsOutput, error) { + req, out := c.CancelCapacityReservationFleetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opCancelConversionTask = "CancelConversionTask" // CancelConversionTaskRequest generates a "aws/request.Request" representing the @@ -3820,6 +3903,82 @@ func (c *EC2) CreateCapacityReservationWithContext(ctx aws.Context, input *Creat return out, req.Send() } +const opCreateCapacityReservationFleet = "CreateCapacityReservationFleet" + +// CreateCapacityReservationFleetRequest generates a "aws/request.Request" representing the +// client's request for the CreateCapacityReservationFleet operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CreateCapacityReservationFleet for more information on using the CreateCapacityReservationFleet +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the CreateCapacityReservationFleetRequest method. +// req, resp := client.CreateCapacityReservationFleetRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateCapacityReservationFleet +func (c *EC2) CreateCapacityReservationFleetRequest(input *CreateCapacityReservationFleetInput) (req *request.Request, output *CreateCapacityReservationFleetOutput) { + op := &request.Operation{ + Name: opCreateCapacityReservationFleet, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateCapacityReservationFleetInput{} + } + + output = &CreateCapacityReservationFleetOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreateCapacityReservationFleet API operation for Amazon Elastic Compute Cloud. +// +// Creates a Capacity Reservation Fleet. For more information, see Create a +// Capacity Reservation Fleet (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/work-with-cr-fleets.html#create-crfleet) +// in the Amazon EC2 User Guide. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation CreateCapacityReservationFleet for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateCapacityReservationFleet +func (c *EC2) CreateCapacityReservationFleet(input *CreateCapacityReservationFleetInput) (*CreateCapacityReservationFleetOutput, error) { + req, out := c.CreateCapacityReservationFleetRequest(input) + return out, req.Send() +} + +// CreateCapacityReservationFleetWithContext is the same as CreateCapacityReservationFleet with the addition of +// the ability to pass a context and additional request options. +// +// See CreateCapacityReservationFleet for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) CreateCapacityReservationFleetWithContext(ctx aws.Context, input *CreateCapacityReservationFleetInput, opts ...request.Option) (*CreateCapacityReservationFleetOutput, error) { + req, out := c.CreateCapacityReservationFleetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opCreateCarrierGateway = "CreateCarrierGateway" // CreateCarrierGatewayRequest generates a "aws/request.Request" representing the @@ -4725,7 +4884,8 @@ func (c *EC2) CreateFpgaImageRequest(input *CreateFpgaImageInput) (req *request. // // An AFI contains the FPGA bitstream that is ready to download to an FPGA. // You can securely deploy an AFI on multiple FPGA-accelerated instances. For -// more information, see the AWS FPGA Hardware Development Kit (https://github.com/aws/aws-fpga/). +// more information, see the Amazon Web Services FPGA Hardware Development Kit +// (https://github.com/aws/aws-fpga/). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -5227,8 +5387,8 @@ func (c *EC2) CreateLaunchTemplateRequest(input *CreateLaunchTemplateInput) (req // Creates a launch template. A launch template contains the parameters to launch // an instance. When you launch an instance using RunInstances, you can specify // a launch template instead of providing the launch parameters in the request. -// For more information, see Launching an instance from a launch template (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html)in -// the Amazon Elastic Compute Cloud User Guide. +// For more information, see Launching an instance from a launch template (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html) +// in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -8551,14 +8711,15 @@ func (c *EC2) CreateVpcEndpointRequest(input *CreateVpcEndpointInput) (req *requ // // Creates a VPC endpoint for a specified service. An endpoint enables you to // create a private connection between your VPC and the service. The service -// may be provided by AWS, an AWS Marketplace Partner, or another AWS account. -// For more information, see VPC Endpoints (https://docs.aws.amazon.com/vpc/latest/userguide/vpc-endpoints.html) +// may be provided by Amazon Web Services, an Amazon Web Services Marketplace +// Partner, or another Amazon Web Services account. For more information, see +// VPC Endpoints (https://docs.aws.amazon.com/vpc/latest/userguide/vpc-endpoints.html) // in the Amazon Virtual Private Cloud User Guide. // // A gateway endpoint serves as a target for a route in your route table for -// traffic destined for the AWS service. You can specify an endpoint policy -// to attach to the endpoint, which will control access to the service from -// your VPC. You can also specify the VPC route tables that use the endpoint. +// traffic destined for the Amazon Web Service. You can specify an endpoint +// policy to attach to the endpoint, which will control access to the service +// from your VPC. You can also specify the VPC route tables that use the endpoint. // // An interface endpoint is a network interface in your subnet that serves as // an endpoint for communicating with the specified service. You can specify @@ -8723,8 +8884,8 @@ func (c *EC2) CreateVpcEndpointServiceConfigurationRequest(input *CreateVpcEndpo // CreateVpcEndpointServiceConfiguration API operation for Amazon Elastic Compute Cloud. // -// Creates a VPC endpoint service configuration to which service consumers (AWS -// accounts, IAM users, and IAM roles) can connect. +// Creates a VPC endpoint service configuration to which service consumers (Amazon +// Web Services accounts, IAM users, and IAM roles) can connect. // // To create an endpoint service configuration, you must first create one of // the following for your service: @@ -14257,7 +14418,7 @@ func (c *EC2) DescribeAvailabilityZonesRequest(input *DescribeAvailabilityZonesI // this request to view the state and any provided messages for that zone. // // For more information about Availability Zones, Local Zones, and Wavelength -// Zones, see Regions, Zones and Outposts (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html) +// Zones, see Regions and zones (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -14502,6 +14663,138 @@ func (c *EC2) DescribeByoipCidrsPagesWithContext(ctx aws.Context, input *Describ return p.Err() } +const opDescribeCapacityReservationFleets = "DescribeCapacityReservationFleets" + +// DescribeCapacityReservationFleetsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeCapacityReservationFleets operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeCapacityReservationFleets for more information on using the DescribeCapacityReservationFleets +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DescribeCapacityReservationFleetsRequest method. +// req, resp := client.DescribeCapacityReservationFleetsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeCapacityReservationFleets +func (c *EC2) DescribeCapacityReservationFleetsRequest(input *DescribeCapacityReservationFleetsInput) (req *request.Request, output *DescribeCapacityReservationFleetsOutput) { + op := &request.Operation{ + Name: opDescribeCapacityReservationFleets, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeCapacityReservationFleetsInput{} + } + + output = &DescribeCapacityReservationFleetsOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeCapacityReservationFleets API operation for Amazon Elastic Compute Cloud. +// +// Describes one or more Capacity Reservation Fleets. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation DescribeCapacityReservationFleets for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeCapacityReservationFleets +func (c *EC2) DescribeCapacityReservationFleets(input *DescribeCapacityReservationFleetsInput) (*DescribeCapacityReservationFleetsOutput, error) { + req, out := c.DescribeCapacityReservationFleetsRequest(input) + return out, req.Send() +} + +// DescribeCapacityReservationFleetsWithContext is the same as DescribeCapacityReservationFleets with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeCapacityReservationFleets for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeCapacityReservationFleetsWithContext(ctx aws.Context, input *DescribeCapacityReservationFleetsInput, opts ...request.Option) (*DescribeCapacityReservationFleetsOutput, error) { + req, out := c.DescribeCapacityReservationFleetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// DescribeCapacityReservationFleetsPages iterates over the pages of a DescribeCapacityReservationFleets operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeCapacityReservationFleets method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeCapacityReservationFleets operation. +// pageNum := 0 +// err := client.DescribeCapacityReservationFleetsPages(params, +// func(page *ec2.DescribeCapacityReservationFleetsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeCapacityReservationFleetsPages(input *DescribeCapacityReservationFleetsInput, fn func(*DescribeCapacityReservationFleetsOutput, bool) bool) error { + return c.DescribeCapacityReservationFleetsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeCapacityReservationFleetsPagesWithContext same as DescribeCapacityReservationFleetsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) DescribeCapacityReservationFleetsPagesWithContext(ctx aws.Context, input *DescribeCapacityReservationFleetsInput, fn func(*DescribeCapacityReservationFleetsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeCapacityReservationFleetsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeCapacityReservationFleetsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*DescribeCapacityReservationFleetsOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + const opDescribeCapacityReservations = "DescribeCapacityReservations" // DescribeCapacityReservationsRequest generates a "aws/request.Request" representing the @@ -16584,7 +16877,7 @@ func (c *EC2) DescribeFleetHistoryRequest(input *DescribeFleetHistoryInput) (req // This ensures that you can query by the last evaluated time and not miss a // recorded event. EC2 Fleet events are available for 48 hours. // -// For more information, see Monitoring your EC2 Fleet (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-fleet.html#monitor-ec2-fleet) +// For more information, see Monitor fleet events using Amazon EventBridge (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/fleet-monitor.html) // in the Amazon EC2 User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -17086,8 +17379,8 @@ func (c *EC2) DescribeFpgaImagesRequest(input *DescribeFpgaImagesInput) (req *re // DescribeFpgaImages API operation for Amazon Elastic Compute Cloud. // // Describes the Amazon FPGA Images (AFIs) available to you. These include public -// AFIs, private AFIs that you own, and AFIs owned by other AWS accounts for -// which you have load permissions. +// AFIs, private AFIs that you own, and AFIs owned by other Amazon Web Services +// accounts for which you have load permissions. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -17767,11 +18060,12 @@ func (c *EC2) DescribeIdFormatRequest(input *DescribeIdFormatInput) (req *reques // | vpc-endpoint | vpc-peering-connection | vpn-connection | vpn-gateway. // // These settings apply to the IAM user who makes the request; they do not apply -// to the entire AWS account. By default, an IAM user defaults to the same settings -// as the root user, unless they explicitly override the settings by running -// the ModifyIdFormat command. Resources created with longer IDs are visible -// to all IAM users, regardless of these settings and provided that they have -// permission to use the relevant Describe command for the resource type. +// to the entire Amazon Web Services account. By default, an IAM user defaults +// to the same settings as the root user, unless they explicitly override the +// settings by running the ModifyIdFormat command. Resources created with longer +// IDs are visible to all IAM users, regardless of these settings and provided +// that they have permission to use the relevant Describe command for the resource +// type. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -22415,12 +22709,12 @@ func (c *EC2) DescribeRegionsRequest(input *DescribeRegionsInput) (req *request. // // Describes the Regions that are enabled for your account, or all Regions. // -// For a list of the Regions supported by Amazon EC2, see Regions and Endpoints -// (https://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region). +// For a list of the Regions supported by Amazon EC2, see Amazon Elastic Compute +// Cloud endpoints and quotas (https://docs.aws.amazon.com/general/latest/gr/ec2-service.html). // // For information about enabling and disabling Regions for your account, see -// Managing AWS Regions (https://docs.aws.amazon.com/general/latest/gr/rande-manage.html) -// in the AWS General Reference. +// Managing Amazon Web Services Regions (https://docs.aws.amazon.com/general/latest/gr/rande-manage.html) +// in the Amazon Web Services General Reference. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -24256,6 +24550,9 @@ func (c *EC2) DescribeSpotFleetRequestHistoryRequest(input *DescribeSpotFleetReq // This ensures that you can query by the last evaluated time and not miss a // recorded event. Spot Fleet events are available for 48 hours. // +// For more information, see Monitor fleet events using Amazon EventBridge (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/fleet-monitor.html) +// in the Amazon EC2 User Guide for Linux Instances. +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -34172,8 +34469,9 @@ func (c *EC2) GetVpnConnectionDeviceSampleConfigurationRequest(input *GetVpnConn // GetVpnConnectionDeviceSampleConfiguration API operation for Amazon Elastic Compute Cloud. // -// Download an AWS-provided sample configuration file to be used with the customer -// gateway device specified for your Site-to-Site VPN connection. +// Download an Amazon Web Services-provided sample configuration file to be +// used with the customer gateway device specified for your Site-to-Site VPN +// connection. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -35059,6 +35357,87 @@ func (c *EC2) ModifyCapacityReservationWithContext(ctx aws.Context, input *Modif return out, req.Send() } +const opModifyCapacityReservationFleet = "ModifyCapacityReservationFleet" + +// ModifyCapacityReservationFleetRequest generates a "aws/request.Request" representing the +// client's request for the ModifyCapacityReservationFleet operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ModifyCapacityReservationFleet for more information on using the ModifyCapacityReservationFleet +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the ModifyCapacityReservationFleetRequest method. +// req, resp := client.ModifyCapacityReservationFleetRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyCapacityReservationFleet +func (c *EC2) ModifyCapacityReservationFleetRequest(input *ModifyCapacityReservationFleetInput) (req *request.Request, output *ModifyCapacityReservationFleetOutput) { + op := &request.Operation{ + Name: opModifyCapacityReservationFleet, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ModifyCapacityReservationFleetInput{} + } + + output = &ModifyCapacityReservationFleetOutput{} + req = c.newRequest(op, input, output) + return +} + +// ModifyCapacityReservationFleet API operation for Amazon Elastic Compute Cloud. +// +// Modifies a Capacity Reservation Fleet. +// +// When you modify the total target capacity of a Capacity Reservation Fleet, +// the Fleet automatically creates new Capacity Reservations, or modifies or +// cancels existing Capacity Reservations in the Fleet to meet the new total +// target capacity. When you modify the end date for the Fleet, the end dates +// for all of the individual Capacity Reservations in the Fleet are updated +// accordingly. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Elastic Compute Cloud's +// API operation ModifyCapacityReservationFleet for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyCapacityReservationFleet +func (c *EC2) ModifyCapacityReservationFleet(input *ModifyCapacityReservationFleetInput) (*ModifyCapacityReservationFleetOutput, error) { + req, out := c.ModifyCapacityReservationFleetRequest(input) + return out, req.Send() +} + +// ModifyCapacityReservationFleetWithContext is the same as ModifyCapacityReservationFleet with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyCapacityReservationFleet for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *EC2) ModifyCapacityReservationFleetWithContext(ctx aws.Context, input *ModifyCapacityReservationFleetInput, opts ...request.Option) (*ModifyCapacityReservationFleetOutput, error) { + req, out := c.ModifyCapacityReservationFleetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opModifyClientVpnEndpoint = "ModifyClientVpnEndpoint" // ModifyClientVpnEndpointRequest generates a "aws/request.Request" representing the @@ -35630,10 +36009,11 @@ func (c *EC2) ModifyIdFormatRequest(input *ModifyIdFormatInput) (req *request.Re // | vpc-endpoint | vpc-peering-connection | vpn-connection | vpn-gateway. // // This setting applies to the IAM user who makes the request; it does not apply -// to the entire AWS account. By default, an IAM user defaults to the same settings -// as the root user. If you're using this action as the root user, then these -// settings apply to the entire account, unless an IAM user explicitly overrides -// these settings for themselves. For more information, see Resource IDs (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/resource-ids.html) +// to the entire Amazon Web Services account. By default, an IAM user defaults +// to the same settings as the root user. If you're using this action as the +// root user, then these settings apply to the entire account, unless an IAM +// user explicitly overrides these settings for themselves. For more information, +// see Resource IDs (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/resource-ids.html) // in the Amazon Elastic Compute Cloud User Guide. // // Resources created with longer IDs are visible to all IAM roles and users, @@ -37130,9 +37510,6 @@ func (c *EC2) ModifyTrafficMirrorFilterNetworkServicesRequest(input *ModifyTraff // to mirror network services, use RemoveNetworkServices to remove the network // services from the Traffic Mirror filter. // -// For information about filter rule properties, see Network Services (https://docs.aws.amazon.com/vpc/latest/mirroring/traffic-mirroring-considerations.html) -// in the Traffic Mirroring User Guide . -// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -38076,7 +38453,7 @@ func (c *EC2) ModifyVpcEndpointServicePermissionsRequest(input *ModifyVpcEndpoin // // Modifies the permissions for your VPC endpoint service (https://docs.aws.amazon.com/vpc/latest/userguide/endpoint-service.html). // You can add or remove permissions for service consumers (IAM users, IAM roles, -// and AWS accounts) to connect to your endpoint service. +// and Amazon Web Services accounts) to connect to your endpoint service. // // If you grant permissions to all principals, the service is public. Any users // who know the name of a public service can send a request to attach an endpoint. @@ -44282,7 +44659,7 @@ type Address struct { InstanceId *string `locationName:"instanceId" type:"string"` // The name of the unique set of Availability Zones, Local Zones, or Wavelength - // Zones from which AWS advertises IP addresses. + // Zones from which Amazon Web Services advertises IP addresses. NetworkBorderGroup *string `locationName:"networkBorderGroup" type:"string"` // The ID of the network interface. @@ -44581,15 +44958,15 @@ type AllocateAddressInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // A unique set of Availability Zones, Local Zones, or Wavelength Zones from - // which AWS advertises IP addresses. Use this parameter to limit the IP address - // to this location. IP addresses cannot move between network border groups. + // which Amazon Web Services advertises IP addresses. Use this parameter to + // limit the IP address to this location. IP addresses cannot move between network + // border groups. // // Use DescribeAvailabilityZones (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeAvailabilityZones.html) // to view the network border groups. // // You cannot use a network border group with EC2 Classic. If you attempt this - // operation on EC2 classic, you will receive an InvalidParameterCombination - // error. For more information, see Error Codes (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html). + // operation on EC2 Classic, you receive an InvalidParameterCombination error. NetworkBorderGroup *string `type:"string"` // The ID of an address pool that you own. Use this parameter to let Amazon @@ -44683,7 +45060,7 @@ type AllocateAddressOutput struct { Domain *string `locationName:"domain" type:"string" enum:"DomainType"` // The set of Availability Zones, Local Zones, or Wavelength Zones from which - // AWS advertises IP addresses. + // Amazon Web Services advertises IP addresses. NetworkBorderGroup *string `locationName:"networkBorderGroup" type:"string"` // The Elastic IP address. @@ -49460,6 +49837,146 @@ func (s *CancelBundleTaskOutput) SetBundleTask(v *BundleTask) *CancelBundleTaskO return s } +// Describes a Capacity Reservation Fleet cancellation error. +type CancelCapacityReservationFleetError struct { + _ struct{} `type:"structure"` + + // The error code. + Code *string `locationName:"code" type:"string"` + + // The error message. + Message *string `locationName:"message" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CancelCapacityReservationFleetError) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CancelCapacityReservationFleetError) GoString() string { + return s.String() +} + +// SetCode sets the Code field's value. +func (s *CancelCapacityReservationFleetError) SetCode(v string) *CancelCapacityReservationFleetError { + s.Code = &v + return s +} + +// SetMessage sets the Message field's value. +func (s *CancelCapacityReservationFleetError) SetMessage(v string) *CancelCapacityReservationFleetError { + s.Message = &v + return s +} + +type CancelCapacityReservationFleetsInput struct { + _ struct{} `type:"structure"` + + // The IDs of the Capacity Reservation Fleets to cancel. + // + // CapacityReservationFleetIds is a required field + CapacityReservationFleetIds []*string `locationName:"CapacityReservationFleetId" locationNameList:"item" type:"list" required:"true"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CancelCapacityReservationFleetsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CancelCapacityReservationFleetsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CancelCapacityReservationFleetsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CancelCapacityReservationFleetsInput"} + if s.CapacityReservationFleetIds == nil { + invalidParams.Add(request.NewErrParamRequired("CapacityReservationFleetIds")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetCapacityReservationFleetIds sets the CapacityReservationFleetIds field's value. +func (s *CancelCapacityReservationFleetsInput) SetCapacityReservationFleetIds(v []*string) *CancelCapacityReservationFleetsInput { + s.CapacityReservationFleetIds = v + return s +} + +// SetDryRun sets the DryRun field's value. +func (s *CancelCapacityReservationFleetsInput) SetDryRun(v bool) *CancelCapacityReservationFleetsInput { + s.DryRun = &v + return s +} + +type CancelCapacityReservationFleetsOutput struct { + _ struct{} `type:"structure"` + + // Information about the Capacity Reservation Fleets that could not be cancelled. + FailedFleetCancellations []*FailedCapacityReservationFleetCancellationResult `locationName:"failedFleetCancellationSet" locationNameList:"item" type:"list"` + + // Information about the Capacity Reservation Fleets that were successfully + // cancelled. + SuccessfulFleetCancellations []*CapacityReservationFleetCancellationState `locationName:"successfulFleetCancellationSet" locationNameList:"item" type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CancelCapacityReservationFleetsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CancelCapacityReservationFleetsOutput) GoString() string { + return s.String() +} + +// SetFailedFleetCancellations sets the FailedFleetCancellations field's value. +func (s *CancelCapacityReservationFleetsOutput) SetFailedFleetCancellations(v []*FailedCapacityReservationFleetCancellationResult) *CancelCapacityReservationFleetsOutput { + s.FailedFleetCancellations = v + return s +} + +// SetSuccessfulFleetCancellations sets the SuccessfulFleetCancellations field's value. +func (s *CancelCapacityReservationFleetsOutput) SetSuccessfulFleetCancellations(v []*CapacityReservationFleetCancellationState) *CancelCapacityReservationFleetsOutput { + s.SuccessfulFleetCancellations = v + return s +} + type CancelCapacityReservationInput struct { _ struct{} `type:"structure"` @@ -50282,6 +50799,11 @@ type CapacityReservation struct { // The Amazon Resource Name (ARN) of the Capacity Reservation. CapacityReservationArn *string `locationName:"capacityReservationArn" type:"string"` + // The ID of the Capacity Reservation Fleet to which the Capacity Reservation + // belongs. Only valid for Capacity Reservations that were created by a Capacity + // Reservation Fleet. + CapacityReservationFleetId *string `locationName:"capacityReservationFleetId" type:"string"` + // The ID of the Capacity Reservation. CapacityReservationId *string `locationName:"capacityReservationId" type:"string"` @@ -50427,6 +50949,12 @@ func (s *CapacityReservation) SetCapacityReservationArn(v string) *CapacityReser return s } +// SetCapacityReservationFleetId sets the CapacityReservationFleetId field's value. +func (s *CapacityReservation) SetCapacityReservationFleetId(v string) *CapacityReservation { + s.CapacityReservationFleetId = &v + return s +} + // SetCapacityReservationId sets the CapacityReservationId field's value. func (s *CapacityReservation) SetCapacityReservationId(v string) *CapacityReservation { s.CapacityReservationId = &v @@ -50523,6 +51051,239 @@ func (s *CapacityReservation) SetTotalInstanceCount(v int64) *CapacityReservatio return s } +// Information about a Capacity Reservation Fleet. +type CapacityReservationFleet struct { + _ struct{} `type:"structure"` + + // The strategy used by the Capacity Reservation Fleet to determine which of + // the specified instance types to use. For more information, see For more information, + // see Allocation strategy (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/crfleet-concepts.html#allocation-strategy) + // in the Amazon EC2 User Guide. + AllocationStrategy *string `locationName:"allocationStrategy" type:"string"` + + // The ARN of the Capacity Reservation Fleet. + CapacityReservationFleetArn *string `locationName:"capacityReservationFleetArn" type:"string"` + + // The ID of the Capacity Reservation Fleet. + CapacityReservationFleetId *string `locationName:"capacityReservationFleetId" type:"string"` + + // The date and time at which the Capacity Reservation Fleet was created. + CreateTime *time.Time `locationName:"createTime" type:"timestamp"` + + // The date and time at which the Capacity Reservation Fleet expires. + EndDate *time.Time `locationName:"endDate" type:"timestamp"` + + // Indicates the type of instance launches that the Capacity Reservation Fleet + // accepts. All Capacity Reservations in the Fleet inherit this instance matching + // criteria. + // + // Currently, Capacity Reservation Fleets support open instance matching criteria + // only. This means that instances that have matching attributes (instance type, + // platform, and Availability Zone) run in the Capacity Reservations automatically. + // Instances do not need to explicitly target a Capacity Reservation Fleet to + // use its reserved capacity. + InstanceMatchCriteria *string `locationName:"instanceMatchCriteria" type:"string" enum:"FleetInstanceMatchCriteria"` + + // Information about the instance types for which to reserve the capacity. + InstanceTypeSpecifications []*FleetCapacityReservation `locationName:"instanceTypeSpecificationSet" locationNameList:"item" type:"list"` + + // The state of the Capacity Reservation Fleet. Possible states include: + // + // * submitted - The Capacity Reservation Fleet request has been submitted + // and Amazon Elastic Compute Cloud is preparing to create the Capacity Reservations. + // + // * modifying - The Capacity Reservation Fleet is being modified. The Fleet + // remains in this state until the modification is complete. + // + // * active - The Capacity Reservation Fleet has fulfilled its total target + // capacity and it is attempting to maintain this capacity. The Fleet remains + // in this state until it is modified or deleted. + // + // * partially_fulfilled - The Capacity Reservation Fleet has partially fulfilled + // its total target capacity. There is insufficient Amazon EC2 to fulfill + // the total target capacity. The Fleet is attempting to asynchronously fulfill + // its total target capacity. + // + // * expiring - The Capacity Reservation Fleet has reach its end date and + // it is in the process of expiring. One or more of its Capacity reservations + // might still be active. + // + // * expired - The Capacity Reservation Fleet has reach its end date. The + // Fleet and its Capacity Reservations are expired. The Fleet can't create + // new Capacity Reservations. + // + // * cancelling - The Capacity Reservation Fleet is in the process of being + // cancelled. One or more of its Capacity reservations might still be active. + // + // * cancelled - The Capacity Reservation Fleet has been manually cancelled. + // The Fleet and its Capacity Reservations are cancelled and the Fleet can't + // create new Capacity Reservations. + // + // * failed - The Capacity Reservation Fleet failed to reserve capacity for + // the specified instance types. + State *string `locationName:"state" type:"string" enum:"CapacityReservationFleetState"` + + // The tags assigned to the Capacity Reservation Fleet. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The tenancy of the Capacity Reservation Fleet. Tenancies include: + // + // * default - The Capacity Reservation Fleet is created on hardware that + // is shared with other Amazon Web Services accounts. + // + // * dedicated - The Capacity Reservation Fleet is created on single-tenant + // hardware that is dedicated to a single Amazon Web Services account. + Tenancy *string `locationName:"tenancy" type:"string" enum:"FleetCapacityReservationTenancy"` + + // The capacity units that have been fulfilled. + TotalFulfilledCapacity *float64 `locationName:"totalFulfilledCapacity" type:"double"` + + // The total number of capacity units for which the Capacity Reservation Fleet + // reserves capacity. For more information, see Total target capacity (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/crfleet-concepts.html#target-capacity) + // in the Amazon EC2 User Guide. + TotalTargetCapacity *int64 `locationName:"totalTargetCapacity" type:"integer"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CapacityReservationFleet) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CapacityReservationFleet) GoString() string { + return s.String() +} + +// SetAllocationStrategy sets the AllocationStrategy field's value. +func (s *CapacityReservationFleet) SetAllocationStrategy(v string) *CapacityReservationFleet { + s.AllocationStrategy = &v + return s +} + +// SetCapacityReservationFleetArn sets the CapacityReservationFleetArn field's value. +func (s *CapacityReservationFleet) SetCapacityReservationFleetArn(v string) *CapacityReservationFleet { + s.CapacityReservationFleetArn = &v + return s +} + +// SetCapacityReservationFleetId sets the CapacityReservationFleetId field's value. +func (s *CapacityReservationFleet) SetCapacityReservationFleetId(v string) *CapacityReservationFleet { + s.CapacityReservationFleetId = &v + return s +} + +// SetCreateTime sets the CreateTime field's value. +func (s *CapacityReservationFleet) SetCreateTime(v time.Time) *CapacityReservationFleet { + s.CreateTime = &v + return s +} + +// SetEndDate sets the EndDate field's value. +func (s *CapacityReservationFleet) SetEndDate(v time.Time) *CapacityReservationFleet { + s.EndDate = &v + return s +} + +// SetInstanceMatchCriteria sets the InstanceMatchCriteria field's value. +func (s *CapacityReservationFleet) SetInstanceMatchCriteria(v string) *CapacityReservationFleet { + s.InstanceMatchCriteria = &v + return s +} + +// SetInstanceTypeSpecifications sets the InstanceTypeSpecifications field's value. +func (s *CapacityReservationFleet) SetInstanceTypeSpecifications(v []*FleetCapacityReservation) *CapacityReservationFleet { + s.InstanceTypeSpecifications = v + return s +} + +// SetState sets the State field's value. +func (s *CapacityReservationFleet) SetState(v string) *CapacityReservationFleet { + s.State = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *CapacityReservationFleet) SetTags(v []*Tag) *CapacityReservationFleet { + s.Tags = v + return s +} + +// SetTenancy sets the Tenancy field's value. +func (s *CapacityReservationFleet) SetTenancy(v string) *CapacityReservationFleet { + s.Tenancy = &v + return s +} + +// SetTotalFulfilledCapacity sets the TotalFulfilledCapacity field's value. +func (s *CapacityReservationFleet) SetTotalFulfilledCapacity(v float64) *CapacityReservationFleet { + s.TotalFulfilledCapacity = &v + return s +} + +// SetTotalTargetCapacity sets the TotalTargetCapacity field's value. +func (s *CapacityReservationFleet) SetTotalTargetCapacity(v int64) *CapacityReservationFleet { + s.TotalTargetCapacity = &v + return s +} + +// Describes a Capacity Reservation Fleet that was successfully cancelled. +type CapacityReservationFleetCancellationState struct { + _ struct{} `type:"structure"` + + // The ID of the Capacity Reservation Fleet that was successfully cancelled. + CapacityReservationFleetId *string `locationName:"capacityReservationFleetId" type:"string"` + + // The current state of the Capacity Reservation Fleet. + CurrentFleetState *string `locationName:"currentFleetState" type:"string" enum:"CapacityReservationFleetState"` + + // The previous state of the Capacity Reservation Fleet. + PreviousFleetState *string `locationName:"previousFleetState" type:"string" enum:"CapacityReservationFleetState"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CapacityReservationFleetCancellationState) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CapacityReservationFleetCancellationState) GoString() string { + return s.String() +} + +// SetCapacityReservationFleetId sets the CapacityReservationFleetId field's value. +func (s *CapacityReservationFleetCancellationState) SetCapacityReservationFleetId(v string) *CapacityReservationFleetCancellationState { + s.CapacityReservationFleetId = &v + return s +} + +// SetCurrentFleetState sets the CurrentFleetState field's value. +func (s *CapacityReservationFleetCancellationState) SetCurrentFleetState(v string) *CapacityReservationFleetCancellationState { + s.CurrentFleetState = &v + return s +} + +// SetPreviousFleetState sets the PreviousFleetState field's value. +func (s *CapacityReservationFleetCancellationState) SetPreviousFleetState(v string) *CapacityReservationFleetCancellationState { + s.PreviousFleetState = &v + return s +} + // Describes a resource group to which a Capacity Reservation has been added. type CapacityReservationGroup struct { _ struct{} `type:"structure"` @@ -52278,10 +53039,10 @@ type CoipAddressUsage struct { // The allocation ID of the address. AllocationId *string `locationName:"allocationId" type:"string"` - // The AWS account ID. + // The Amazon Web Services account ID. AwsAccountId *string `locationName:"awsAccountId" type:"string"` - // The AWS service. + // The Amazon Web Services service. AwsService *string `locationName:"awsService" type:"string"` // The customer-owned IP address. @@ -52798,7 +53559,7 @@ type CopyFpgaImageInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier that you provide to ensure the idempotency - // of the request. For more information, see Ensuring Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html). + // of the request. For more information, see Ensuring idempotency (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html). ClientToken *string `type:"string"` // The description for the new AFI. @@ -53434,6 +54195,300 @@ func (s *CpuOptionsRequest) SetThreadsPerCore(v int64) *CpuOptionsRequest { return s } +type CreateCapacityReservationFleetInput struct { + _ struct{} `type:"structure"` + + // The strategy used by the Capacity Reservation Fleet to determine which of + // the specified instance types to use. Currently, only the prioritized allocation + // strategy is supported. For more information, see Allocation strategy (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/crfleet-concepts.html#allocation-strategy) + // in the Amazon EC2 User Guide. + // + // Valid values: prioritized + AllocationStrategy *string `type:"string"` + + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. For more information, see Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + ClientToken *string `type:"string" idempotencyToken:"true"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The date and time at which the Capacity Reservation Fleet expires. When the + // Capacity Reservation Fleet expires, its state changes to expired and all + // of the Capacity Reservations in the Fleet expire. + // + // The Capacity Reservation Fleet expires within an hour after the specified + // time. For example, if you specify 5/31/2019, 13:30:55, the Capacity Reservation + // Fleet is guaranteed to expire between 13:30:55 and 14:30:55 on 5/31/2019. + EndDate *time.Time `type:"timestamp"` + + // Indicates the type of instance launches that the Capacity Reservation Fleet + // accepts. All Capacity Reservations in the Fleet inherit this instance matching + // criteria. + // + // Currently, Capacity Reservation Fleets support open instance matching criteria + // only. This means that instances that have matching attributes (instance type, + // platform, and Availability Zone) run in the Capacity Reservations automatically. + // Instances do not need to explicitly target a Capacity Reservation Fleet to + // use its reserved capacity. + InstanceMatchCriteria *string `type:"string" enum:"FleetInstanceMatchCriteria"` + + // Information about the instance types for which to reserve the capacity. + // + // InstanceTypeSpecifications is a required field + InstanceTypeSpecifications []*ReservationFleetInstanceSpecification `locationName:"InstanceTypeSpecification" type:"list" required:"true"` + + // The tags to assign to the Capacity Reservation Fleet. The tags are automatically + // assigned to the Capacity Reservations in the Fleet. + TagSpecifications []*TagSpecification `locationName:"TagSpecification" locationNameList:"item" type:"list"` + + // Indicates the tenancy of the Capacity Reservation Fleet. All Capacity Reservations + // in the Fleet inherit this tenancy. The Capacity Reservation Fleet can have + // one of the following tenancy settings: + // + // * default - The Capacity Reservation Fleet is created on hardware that + // is shared with other Amazon Web Services accounts. + // + // * dedicated - The Capacity Reservations are created on single-tenant hardware + // that is dedicated to a single Amazon Web Services account. + Tenancy *string `type:"string" enum:"FleetCapacityReservationTenancy"` + + // The total number of capacity units to be reserved by the Capacity Reservation + // Fleet. This value, together with the instance type weights that you assign + // to each instance type used by the Fleet determine the number of instances + // for which the Fleet reserves capacity. Both values are based on units that + // make sense for your workload. For more information, see Total target capacity + // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/crfleet-concepts.html#target-capacity) + // in the Amazon EC2 User Guide. + // + // TotalTargetCapacity is a required field + TotalTargetCapacity *int64 `type:"integer" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateCapacityReservationFleetInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateCapacityReservationFleetInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateCapacityReservationFleetInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateCapacityReservationFleetInput"} + if s.InstanceTypeSpecifications == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceTypeSpecifications")) + } + if s.TotalTargetCapacity == nil { + invalidParams.Add(request.NewErrParamRequired("TotalTargetCapacity")) + } + if s.InstanceTypeSpecifications != nil { + for i, v := range s.InstanceTypeSpecifications { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "InstanceTypeSpecifications", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAllocationStrategy sets the AllocationStrategy field's value. +func (s *CreateCapacityReservationFleetInput) SetAllocationStrategy(v string) *CreateCapacityReservationFleetInput { + s.AllocationStrategy = &v + return s +} + +// SetClientToken sets the ClientToken field's value. +func (s *CreateCapacityReservationFleetInput) SetClientToken(v string) *CreateCapacityReservationFleetInput { + s.ClientToken = &v + return s +} + +// SetDryRun sets the DryRun field's value. +func (s *CreateCapacityReservationFleetInput) SetDryRun(v bool) *CreateCapacityReservationFleetInput { + s.DryRun = &v + return s +} + +// SetEndDate sets the EndDate field's value. +func (s *CreateCapacityReservationFleetInput) SetEndDate(v time.Time) *CreateCapacityReservationFleetInput { + s.EndDate = &v + return s +} + +// SetInstanceMatchCriteria sets the InstanceMatchCriteria field's value. +func (s *CreateCapacityReservationFleetInput) SetInstanceMatchCriteria(v string) *CreateCapacityReservationFleetInput { + s.InstanceMatchCriteria = &v + return s +} + +// SetInstanceTypeSpecifications sets the InstanceTypeSpecifications field's value. +func (s *CreateCapacityReservationFleetInput) SetInstanceTypeSpecifications(v []*ReservationFleetInstanceSpecification) *CreateCapacityReservationFleetInput { + s.InstanceTypeSpecifications = v + return s +} + +// SetTagSpecifications sets the TagSpecifications field's value. +func (s *CreateCapacityReservationFleetInput) SetTagSpecifications(v []*TagSpecification) *CreateCapacityReservationFleetInput { + s.TagSpecifications = v + return s +} + +// SetTenancy sets the Tenancy field's value. +func (s *CreateCapacityReservationFleetInput) SetTenancy(v string) *CreateCapacityReservationFleetInput { + s.Tenancy = &v + return s +} + +// SetTotalTargetCapacity sets the TotalTargetCapacity field's value. +func (s *CreateCapacityReservationFleetInput) SetTotalTargetCapacity(v int64) *CreateCapacityReservationFleetInput { + s.TotalTargetCapacity = &v + return s +} + +type CreateCapacityReservationFleetOutput struct { + _ struct{} `type:"structure"` + + // The allocation strategy used by the Capacity Reservation Fleet. + AllocationStrategy *string `locationName:"allocationStrategy" type:"string"` + + // The ID of the Capacity Reservation Fleet. + CapacityReservationFleetId *string `locationName:"capacityReservationFleetId" type:"string"` + + // The date and time at which the Capacity Reservation Fleet was created. + CreateTime *time.Time `locationName:"createTime" type:"timestamp"` + + // The date and time at which the Capacity Reservation Fleet expires. + EndDate *time.Time `locationName:"endDate" type:"timestamp"` + + // Information about the individual Capacity Reservations in the Capacity Reservation + // Fleet. + FleetCapacityReservations []*FleetCapacityReservation `locationName:"fleetCapacityReservationSet" locationNameList:"item" type:"list"` + + // The instance matching criteria for the Capacity Reservation Fleet. + InstanceMatchCriteria *string `locationName:"instanceMatchCriteria" type:"string" enum:"FleetInstanceMatchCriteria"` + + // The status of the Capacity Reservation Fleet. + State *string `locationName:"state" type:"string" enum:"CapacityReservationFleetState"` + + // The tags assigned to the Capacity Reservation Fleet. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // Indicates the tenancy of Capacity Reservation Fleet. + Tenancy *string `locationName:"tenancy" type:"string" enum:"FleetCapacityReservationTenancy"` + + // The requested capacity units that have been successfully reserved. + TotalFulfilledCapacity *float64 `locationName:"totalFulfilledCapacity" type:"double"` + + // The total number of capacity units for which the Capacity Reservation Fleet + // reserves capacity. + TotalTargetCapacity *int64 `locationName:"totalTargetCapacity" type:"integer"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateCapacityReservationFleetOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateCapacityReservationFleetOutput) GoString() string { + return s.String() +} + +// SetAllocationStrategy sets the AllocationStrategy field's value. +func (s *CreateCapacityReservationFleetOutput) SetAllocationStrategy(v string) *CreateCapacityReservationFleetOutput { + s.AllocationStrategy = &v + return s +} + +// SetCapacityReservationFleetId sets the CapacityReservationFleetId field's value. +func (s *CreateCapacityReservationFleetOutput) SetCapacityReservationFleetId(v string) *CreateCapacityReservationFleetOutput { + s.CapacityReservationFleetId = &v + return s +} + +// SetCreateTime sets the CreateTime field's value. +func (s *CreateCapacityReservationFleetOutput) SetCreateTime(v time.Time) *CreateCapacityReservationFleetOutput { + s.CreateTime = &v + return s +} + +// SetEndDate sets the EndDate field's value. +func (s *CreateCapacityReservationFleetOutput) SetEndDate(v time.Time) *CreateCapacityReservationFleetOutput { + s.EndDate = &v + return s +} + +// SetFleetCapacityReservations sets the FleetCapacityReservations field's value. +func (s *CreateCapacityReservationFleetOutput) SetFleetCapacityReservations(v []*FleetCapacityReservation) *CreateCapacityReservationFleetOutput { + s.FleetCapacityReservations = v + return s +} + +// SetInstanceMatchCriteria sets the InstanceMatchCriteria field's value. +func (s *CreateCapacityReservationFleetOutput) SetInstanceMatchCriteria(v string) *CreateCapacityReservationFleetOutput { + s.InstanceMatchCriteria = &v + return s +} + +// SetState sets the State field's value. +func (s *CreateCapacityReservationFleetOutput) SetState(v string) *CreateCapacityReservationFleetOutput { + s.State = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *CreateCapacityReservationFleetOutput) SetTags(v []*Tag) *CreateCapacityReservationFleetOutput { + s.Tags = v + return s +} + +// SetTenancy sets the Tenancy field's value. +func (s *CreateCapacityReservationFleetOutput) SetTenancy(v string) *CreateCapacityReservationFleetOutput { + s.Tenancy = &v + return s +} + +// SetTotalFulfilledCapacity sets the TotalFulfilledCapacity field's value. +func (s *CreateCapacityReservationFleetOutput) SetTotalFulfilledCapacity(v float64) *CreateCapacityReservationFleetOutput { + s.TotalFulfilledCapacity = &v + return s +} + +// SetTotalTargetCapacity sets the TotalTargetCapacity field's value. +func (s *CreateCapacityReservationFleetOutput) SetTotalTargetCapacity(v int64) *CreateCapacityReservationFleetOutput { + s.TotalTargetCapacity = &v + return s +} + type CreateCapacityReservationInput struct { _ struct{} `type:"structure"` @@ -55217,7 +56272,8 @@ type CreateFlowLogsInput struct { // If you specify this parameter, you must specify at least one field. // // Specify the fields using the ${field-id} format, separated by spaces. For - // the CLI, use single quotation marks (' ') to surround the parameter value. + // the CLI, surround this parameter value with single quotes on Linux or double + // quotes on Windows. LogFormat *string `type:"string"` // The name of a new or existing CloudWatch Logs log group where Amazon EC2 @@ -59690,7 +60746,7 @@ type CreateTrafficMirrorFilterInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier that you provide to ensure the idempotency - // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // of the request. For more information, see How to ensure idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `type:"string" idempotencyToken:"true"` // The description of the Traffic Mirror filter. @@ -59752,7 +60808,7 @@ type CreateTrafficMirrorFilterOutput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier that you provide to ensure the idempotency - // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // of the request. For more information, see How to ensure idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `locationName:"clientToken" type:"string"` // Information about the Traffic Mirror filter. @@ -59793,7 +60849,7 @@ type CreateTrafficMirrorFilterRuleInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier that you provide to ensure the idempotency - // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // of the request. For more information, see How to ensure idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `type:"string" idempotencyToken:"true"` // The description of the Traffic Mirror rule. @@ -59819,7 +60875,7 @@ type CreateTrafficMirrorFilterRuleInput struct { // on the Internet Assigned Numbers Authority (IANA) website. Protocol *int64 `type:"integer"` - // The action to take (accept | reject) on the filtered traffic. + // The action to take on the filtered traffic. // // RuleAction is a required field RuleAction *string `type:"string" required:"true" enum:"TrafficMirrorRuleAction"` @@ -59839,7 +60895,7 @@ type CreateTrafficMirrorFilterRuleInput struct { // The source port range. SourcePortRange *TrafficMirrorPortRangeRequest `type:"structure"` - // The type of traffic (ingress | egress). + // The type of traffic. // // TrafficDirection is a required field TrafficDirection *string `type:"string" required:"true" enum:"TrafficDirection"` @@ -59972,7 +61028,7 @@ type CreateTrafficMirrorFilterRuleOutput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier that you provide to ensure the idempotency - // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // of the request. For more information, see How to ensure idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `locationName:"clientToken" type:"string"` // The Traffic Mirror rule. @@ -60013,7 +61069,7 @@ type CreateTrafficMirrorSessionInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier that you provide to ensure the idempotency - // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // of the request. For more information, see How to ensure idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `type:"string" idempotencyToken:"true"` // The description of the Traffic Mirror session. @@ -60173,7 +61229,7 @@ type CreateTrafficMirrorSessionOutput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier that you provide to ensure the idempotency - // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // of the request. For more information, see How to ensure idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `locationName:"clientToken" type:"string"` // Information about the Traffic Mirror session. @@ -60214,7 +61270,7 @@ type CreateTrafficMirrorTargetInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier that you provide to ensure the idempotency - // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // of the request. For more information, see How to ensure idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `type:"string" idempotencyToken:"true"` // The description of the Traffic Mirror target. @@ -60295,7 +61351,7 @@ type CreateTrafficMirrorTargetOutput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier that you provide to ensure the idempotency - // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // of the request. For more information, see How to ensure idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `locationName:"clientToken" type:"string"` // Information about the Traffic Mirror target. @@ -61897,7 +62953,7 @@ type CreateVpcEndpointConnectionNotificationInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier that you provide to ensure the idempotency - // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // of the request. For more information, see How to ensure idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `type:"string"` // One or more endpoint events for which to receive notifications. Valid values @@ -62040,7 +63096,7 @@ type CreateVpcEndpointInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier that you provide to ensure the idempotency - // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // of the request. For more information, see How to ensure idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `type:"string"` // Checks whether you have the required permissions for the action, without @@ -62252,7 +63308,7 @@ type CreateVpcEndpointServiceConfigurationInput struct { AcceptanceRequired *bool `type:"boolean"` // Unique, case-sensitive identifier that you provide to ensure the idempotency - // of the request. For more information, see How to Ensure Idempotency (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html). + // of the request. For more information, see How to ensure idempotency (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html). ClientToken *string `type:"string"` // Checks whether you have the required permissions for the action, without @@ -69725,6 +70781,144 @@ func (s *DescribeByoipCidrsOutput) SetNextToken(v string) *DescribeByoipCidrsOut return s } +type DescribeCapacityReservationFleetsInput struct { + _ struct{} `type:"structure"` + + // The IDs of the Capacity Reservation Fleets to describe. + CapacityReservationFleetIds []*string `locationName:"CapacityReservationFleetId" locationNameList:"item" type:"list"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // One or more filters. + // + // * state - The state of the Fleet (submitted | modifying | active | partially_fulfilled + // | expiring | expired | cancelling | cancelled | failed). + // + // * instance-match-criteria - The instance matching criteria for the Fleet. + // Only open is supported. + // + // * tenancy - The tenancy of the Fleet (default | dedicated). + // + // * allocation-strategy - The allocation strategy used by the Fleet. Only + // prioritized is supported. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // The maximum number of results to return for the request in a single page. + // The remaining results can be seen by sending another request with the returned + // nextToken value. This value can be between 5 and 500. If maxResults is given + // a larger value than 500, you receive an error. + MaxResults *int64 `min:"1" type:"integer"` + + // The token to use to retrieve the next page of results. + NextToken *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeCapacityReservationFleetsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeCapacityReservationFleetsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeCapacityReservationFleetsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeCapacityReservationFleetsInput"} + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetCapacityReservationFleetIds sets the CapacityReservationFleetIds field's value. +func (s *DescribeCapacityReservationFleetsInput) SetCapacityReservationFleetIds(v []*string) *DescribeCapacityReservationFleetsInput { + s.CapacityReservationFleetIds = v + return s +} + +// SetDryRun sets the DryRun field's value. +func (s *DescribeCapacityReservationFleetsInput) SetDryRun(v bool) *DescribeCapacityReservationFleetsInput { + s.DryRun = &v + return s +} + +// SetFilters sets the Filters field's value. +func (s *DescribeCapacityReservationFleetsInput) SetFilters(v []*Filter) *DescribeCapacityReservationFleetsInput { + s.Filters = v + return s +} + +// SetMaxResults sets the MaxResults field's value. +func (s *DescribeCapacityReservationFleetsInput) SetMaxResults(v int64) *DescribeCapacityReservationFleetsInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeCapacityReservationFleetsInput) SetNextToken(v string) *DescribeCapacityReservationFleetsInput { + s.NextToken = &v + return s +} + +type DescribeCapacityReservationFleetsOutput struct { + _ struct{} `type:"structure"` + + // Information about the Capacity Reservation Fleets. + CapacityReservationFleets []*CapacityReservationFleet `locationName:"capacityReservationFleetSet" locationNameList:"item" type:"list"` + + // The token to use to retrieve the next page of results. This value is null + // when there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeCapacityReservationFleetsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeCapacityReservationFleetsOutput) GoString() string { + return s.String() +} + +// SetCapacityReservationFleets sets the CapacityReservationFleets field's value. +func (s *DescribeCapacityReservationFleetsOutput) SetCapacityReservationFleets(v []*CapacityReservationFleet) *DescribeCapacityReservationFleetsOutput { + s.CapacityReservationFleets = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeCapacityReservationFleetsOutput) SetNextToken(v string) *DescribeCapacityReservationFleetsOutput { + s.NextToken = &v + return s +} + type DescribeCapacityReservationsInput struct { _ struct{} `type:"structure"` @@ -72907,12 +74101,12 @@ type DescribeFpgaImagesInput struct { // // * name - The name of the AFI. // - // * owner-id - The AWS account ID of the AFI owner. + // * owner-id - The Amazon Web Services account ID of the AFI owner. // // * product-code - The product code. // - // * shell-version - The version of the AWS Shell that was used to create - // the bitstream. + // * shell-version - The version of the Amazon Web Services Shell that was + // used to create the bitstream. // // * state - The state of the AFI (pending | failed | available | unavailable). // @@ -72938,8 +74132,9 @@ type DescribeFpgaImagesInput struct { // The token to retrieve the next page of results. NextToken *string `type:"string"` - // Filters the AFI by owner. Specify an AWS account ID, self (owner is the sender - // of the request), or an AWS owner alias (valid values are amazon | aws-marketplace). + // Filters the AFI by owner. Specify an Amazon Web Services account ID, self + // (owner is the sender of the request), or an Amazon Web Services owner alias + // (valid values are amazon | aws-marketplace). Owners []*string `locationName:"Owner" locationNameList:"Owner" type:"list"` } @@ -85511,7 +86706,8 @@ type DescribeVpcEndpointConnectionsInput struct { // // * service-id - The ID of the service. // - // * vpc-endpoint-owner - The AWS account number of the owner of the endpoint. + // * vpc-endpoint-owner - The ID of the Amazon Web Services account ID that + // owns the endpoint. // // * vpc-endpoint-state - The state of the endpoint (pendingAcceptance | // pending | available | deleting | deleted | rejected | failed). @@ -91747,64 +92943,82 @@ type EventInformation struct { // The event. // - // The following are the error events: + // error events: // - // * iamFleetRoleInvalid - The EC2 Fleet or Spot Fleet did not have the required - // permissions either to launch or terminate an instance. + // * iamFleetRoleInvalid - The EC2 Fleet or Spot Fleet does not have the + // required permissions either to launch or terminate an instance. // - // * spotFleetRequestConfigurationInvalid - The configuration is not valid. - // For more information, see the description of the event. + // * allLaunchSpecsTemporarilyBlacklisted - None of the configurations are + // valid, and several attempts to launch instances have failed. For more + // information, see the description of the event. // // * spotInstanceCountLimitExceeded - You've reached the limit on the number // of Spot Instances that you can launch. // - // The following are the fleetRequestChange events: + // * spotFleetRequestConfigurationInvalid - The configuration is not valid. + // For more information, see the description of the event. + // + // fleetRequestChange events: // // * active - The EC2 Fleet or Spot Fleet request has been validated and - // Amazon EC2 is attempting to maintain the target number of running Spot - // Instances. + // Amazon EC2 is attempting to maintain the target number of running instances. // // * cancelled - The EC2 Fleet or Spot Fleet request is canceled and has - // no running Spot Instances. The EC2 Fleet or Spot Fleet will be deleted - // two days after its instances were terminated. + // no running instances. The EC2 Fleet or Spot Fleet will be deleted two + // days after its instances are terminated. // // * cancelled_running - The EC2 Fleet or Spot Fleet request is canceled - // and does not launch additional Spot Instances. Existing Spot Instances - // continue to run until they are interrupted or terminated. + // and does not launch additional instances. Its existing instances continue + // to run until they are interrupted or terminated. The request remains in + // this state until all instances are interrupted or terminated. // // * cancelled_terminating - The EC2 Fleet or Spot Fleet request is canceled - // and its Spot Instances are terminating. + // and its instances are terminating. The request remains in this state until + // all instances are terminated. // - // * expired - The EC2 Fleet or Spot Fleet request has expired. A subsequent - // event indicates that the instances were terminated, if the request was - // created with TerminateInstancesWithExpiration set. + // * expired - The EC2 Fleet or Spot Fleet request has expired. If the request + // was created with TerminateInstancesWithExpiration set, a subsequent terminated + // event indicates that the instances are terminated. // - // * modify_in_progress - A request to modify the EC2 Fleet or Spot Fleet - // request was accepted and is in progress. + // * modify_in_progress - The EC2 Fleet or Spot Fleet request is being modified. + // The request remains in this state until the modification is fully processed. // // * modify_succeeded - The EC2 Fleet or Spot Fleet request was modified. // // * submitted - The EC2 Fleet or Spot Fleet request is being evaluated and - // Amazon EC2 is preparing to launch the target number of Spot Instances. + // Amazon EC2 is preparing to launch the target number of instances. // - // The following are the instanceChange events: + // * progress - The EC2 Fleet or Spot Fleet request is in the process of + // being fulfilled. // - // * launched - A request was fulfilled and a new instance was launched. + // instanceChange events: + // + // * launched - A new instance was launched. // // * terminated - An instance was terminated by the user. // - // The following are the Information events: + // * termination_notified - An instance termination notification was sent + // when a Spot Instance was terminated by Amazon EC2 during scale-down, when + // the target capacity of the fleet was modified down, for example, from + // a target capacity of 4 to a target capacity of 3. + // + // Information events: + // + // * fleetProgressHalted - The price in every launch specification is not + // valid because it is below the Spot price (all the launch specifications + // have produced launchSpecUnusable events). A launch specification might + // become valid if the Spot price changes. // // * launchSpecTemporarilyBlacklisted - The configuration is not valid and // several attempts to launch instances have failed. For more information, // see the description of the event. // // * launchSpecUnusable - The price in a launch specification is not valid - // because it is below the Spot price or the Spot price is above the On-Demand - // price. + // because it is below the Spot price. // - // * fleetProgressHalted - The price in every launch specification is not - // valid. A launch specification might become valid if the Spot price changes. + // * registerWithLoadBalancersFailed - An attempt to register instances with + // load balancers failed. For more information, see the description of the + // event. EventSubType *string `locationName:"eventSubType" type:"string"` // The ID of the instance. This information is available only for instanceChange @@ -93253,6 +94467,47 @@ func (s *ExportTransitGatewayRoutesOutput) SetS3Location(v string) *ExportTransi return s } +// Describes a Capacity Reservation Fleet that could not be cancelled. +type FailedCapacityReservationFleetCancellationResult struct { + _ struct{} `type:"structure"` + + // Information about the Capacity Reservation Fleet cancellation error. + CancelCapacityReservationFleetError *CancelCapacityReservationFleetError `locationName:"cancelCapacityReservationFleetError" type:"structure"` + + // The ID of the Capacity Reservation Fleet that could not be cancelled. + CapacityReservationFleetId *string `locationName:"capacityReservationFleetId" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s FailedCapacityReservationFleetCancellationResult) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s FailedCapacityReservationFleetCancellationResult) GoString() string { + return s.String() +} + +// SetCancelCapacityReservationFleetError sets the CancelCapacityReservationFleetError field's value. +func (s *FailedCapacityReservationFleetCancellationResult) SetCancelCapacityReservationFleetError(v *CancelCapacityReservationFleetError) *FailedCapacityReservationFleetCancellationResult { + s.CancelCapacityReservationFleetError = v + return s +} + +// SetCapacityReservationFleetId sets the CapacityReservationFleetId field's value. +func (s *FailedCapacityReservationFleetCancellationResult) SetCapacityReservationFleetId(v string) *FailedCapacityReservationFleetCancellationResult { + s.CapacityReservationFleetId = &v + return s +} + // Describes a Reserved Instance whose queued purchase was not deleted. type FailedQueuedPurchaseDeletion struct { _ struct{} `type:"structure"` @@ -93421,6 +94676,138 @@ func (s *Filter) SetValues(v []*string) *Filter { return s } +// Information about a Capacity Reservation in a Capacity Reservation Fleet. +type FleetCapacityReservation struct { + _ struct{} `type:"structure"` + + // The Availability Zone in which the Capacity Reservation reserves capacity. + AvailabilityZone *string `locationName:"availabilityZone" type:"string"` + + // The ID of the Availability Zone in which the Capacity Reservation reserves + // capacity. + AvailabilityZoneId *string `locationName:"availabilityZoneId" type:"string"` + + // The ID of the Capacity Reservation. + CapacityReservationId *string `locationName:"capacityReservationId" type:"string"` + + // The date and time at which the Capacity Reservation was created. + CreateDate *time.Time `locationName:"createDate" type:"timestamp"` + + // Indicates whether the Capacity Reservation reserves capacity for EBS-optimized + // instance types. + EbsOptimized *bool `locationName:"ebsOptimized" type:"boolean"` + + // The number of capacity units fulfilled by the Capacity Reservation. For more + // information, see Total target capacity (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/crfleet-concepts.html#target-capacity) + // in the Amazon EC2 User Guide. + FulfilledCapacity *float64 `locationName:"fulfilledCapacity" type:"double"` + + // The type of operating system for which the Capacity Reservation reserves + // capacity. + InstancePlatform *string `locationName:"instancePlatform" type:"string" enum:"CapacityReservationInstancePlatform"` + + // The instance type for which the Capacity Reservation reserves capacity. + InstanceType *string `locationName:"instanceType" type:"string" enum:"InstanceType"` + + // The priority of the instance type in the Capacity Reservation Fleet. For + // more information, see Instance type priority (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/crfleet-concepts.html#instance-priority) + // in the Amazon EC2 User Guide. + Priority *int64 `locationName:"priority" type:"integer"` + + // The total number of instances for which the Capacity Reservation reserves + // capacity. + TotalInstanceCount *int64 `locationName:"totalInstanceCount" type:"integer"` + + // The weight of the instance type in the Capacity Reservation Fleet. For more + // information, see Instance type weight (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/crfleet-concepts.html#instance-weight) + // in the Amazon EC2 User Guide. + Weight *float64 `locationName:"weight" min:"0.001" type:"double"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s FleetCapacityReservation) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s FleetCapacityReservation) GoString() string { + return s.String() +} + +// SetAvailabilityZone sets the AvailabilityZone field's value. +func (s *FleetCapacityReservation) SetAvailabilityZone(v string) *FleetCapacityReservation { + s.AvailabilityZone = &v + return s +} + +// SetAvailabilityZoneId sets the AvailabilityZoneId field's value. +func (s *FleetCapacityReservation) SetAvailabilityZoneId(v string) *FleetCapacityReservation { + s.AvailabilityZoneId = &v + return s +} + +// SetCapacityReservationId sets the CapacityReservationId field's value. +func (s *FleetCapacityReservation) SetCapacityReservationId(v string) *FleetCapacityReservation { + s.CapacityReservationId = &v + return s +} + +// SetCreateDate sets the CreateDate field's value. +func (s *FleetCapacityReservation) SetCreateDate(v time.Time) *FleetCapacityReservation { + s.CreateDate = &v + return s +} + +// SetEbsOptimized sets the EbsOptimized field's value. +func (s *FleetCapacityReservation) SetEbsOptimized(v bool) *FleetCapacityReservation { + s.EbsOptimized = &v + return s +} + +// SetFulfilledCapacity sets the FulfilledCapacity field's value. +func (s *FleetCapacityReservation) SetFulfilledCapacity(v float64) *FleetCapacityReservation { + s.FulfilledCapacity = &v + return s +} + +// SetInstancePlatform sets the InstancePlatform field's value. +func (s *FleetCapacityReservation) SetInstancePlatform(v string) *FleetCapacityReservation { + s.InstancePlatform = &v + return s +} + +// SetInstanceType sets the InstanceType field's value. +func (s *FleetCapacityReservation) SetInstanceType(v string) *FleetCapacityReservation { + s.InstanceType = &v + return s +} + +// SetPriority sets the Priority field's value. +func (s *FleetCapacityReservation) SetPriority(v int64) *FleetCapacityReservation { + s.Priority = &v + return s +} + +// SetTotalInstanceCount sets the TotalInstanceCount field's value. +func (s *FleetCapacityReservation) SetTotalInstanceCount(v int64) *FleetCapacityReservation { + s.TotalInstanceCount = &v + return s +} + +// SetWeight sets the Weight field's value. +func (s *FleetCapacityReservation) SetWeight(v float64) *FleetCapacityReservation { + s.Weight = &v + return s +} + // Describes an EC2 Fleet. type FleetData struct { _ struct{} `type:"structure"` @@ -94553,7 +95940,7 @@ type FpgaImage struct { // The alias of the AFI owner. Possible values include self, amazon, and aws-marketplace. OwnerAlias *string `locationName:"ownerAlias" type:"string"` - // The AWS account ID of the AFI owner. + // The ID of the Amazon Web Services account that owns the AFI. OwnerId *string `locationName:"ownerId" type:"string"` // Information about the PCI bus. @@ -94565,7 +95952,8 @@ type FpgaImage struct { // Indicates whether the AFI is public. Public *bool `locationName:"public" type:"boolean"` - // The version of the AWS Shell that was used to create the bitstream. + // The version of the Amazon Web Services Shell that was used to create the + // bitstream. ShellVersion *string `locationName:"shellVersion" type:"string"` // Information about the state of the AFI. @@ -99766,9 +101154,8 @@ type ImportImageInput struct { // The tags to apply to the import image task during creation. TagSpecifications []*TagSpecification `locationName:"TagSpecification" locationNameList:"item" type:"list"` - // The usage operation value. For more information, see AMI billing information - // fields (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/billing-info-fields.html) - // in the Amazon Elastic Compute Cloud User Guide. + // The usage operation value. For more information, see Licensing options (https://docs.aws.amazon.com/vm-import/latest/userguide/vmie_prereqs.html#prerequisites) + // in the VM Import/Export User Guide. UsageOperation *string `type:"string"` } @@ -102839,8 +104226,8 @@ func (s *InstanceMarketOptionsRequest) SetSpotOptions(v *SpotMarketOptions) *Ins type InstanceMetadataOptionsRequest struct { _ struct{} `type:"structure"` - // This parameter enables or disables the HTTP metadata endpoint on your instances. - // If the parameter is not specified, the default state is enabled. + // Enables or disables the HTTP metadata endpoint on your instances. If the + // parameter is not specified, the default state is enabled. // // If you specify a value of disabled, you will not be able to access your instance // metadata. @@ -102919,15 +104306,12 @@ func (s *InstanceMetadataOptionsRequest) SetHttpTokens(v string) *InstanceMetada type InstanceMetadataOptionsResponse struct { _ struct{} `type:"structure"` - // This parameter enables or disables the HTTP metadata endpoint on your instances. - // If the parameter is not specified, the default state is enabled. - // - // If you specify a value of disabled, you will not be able to access your instance - // metadata. + // Indicates whether the HTTP metadata endpoint on your instances is enabled + // or disabled. HttpEndpoint *string `locationName:"httpEndpoint" type:"string" enum:"InstanceMetadataEndpointState"` - // Whether or not the IPv6 endpoint for the instance metadata service is enabled - // or disabled. + // Indicates whether the IPv6 endpoint for the instance metadata service is + // enabled or disabled. HttpProtocolIpv6 *string `locationName:"httpProtocolIpv6" type:"string" enum:"InstanceMetadataProtocolState"` // The desired HTTP PUT response hop limit for instance metadata requests. The @@ -108239,7 +109623,7 @@ type LoadPermission struct { // The name of the group. Group *string `locationName:"group" type:"string" enum:"PermissionGroup"` - // The AWS account ID. + // The Amazon Web Services account ID. UserId *string `locationName:"userId" type:"string"` } @@ -108321,7 +109705,7 @@ type LoadPermissionRequest struct { // The name of the group. Group *string `type:"string" enum:"PermissionGroup"` - // The AWS account ID. + // The Amazon Web Services account ID. UserId *string `type:"string"` } @@ -108365,7 +109749,7 @@ type LocalGateway struct { // The Amazon Resource Name (ARN) of the Outpost. OutpostArn *string `locationName:"outpostArn" type:"string"` - // The AWS account ID that owns the local gateway. + // The ID of the Amazon Web Services account that owns the local gateway. OwnerId *string `locationName:"ownerId" type:"string"` // The state of the local gateway. @@ -108439,7 +109823,7 @@ type LocalGatewayRoute struct { // The ID of the virtual interface group. LocalGatewayVirtualInterfaceGroupId *string `locationName:"localGatewayVirtualInterfaceGroupId" type:"string"` - // The AWS account ID that owns the local gateway route. + // The ID of the Amazon Web Services account that owns the local gateway route. OwnerId *string `locationName:"ownerId" type:"string"` // The state of the route. @@ -108525,7 +109909,8 @@ type LocalGatewayRouteTable struct { // The Amazon Resource Name (ARN) of the Outpost. OutpostArn *string `locationName:"outpostArn" type:"string"` - // The AWS account ID that owns the local gateway route table. + // The ID of the Amazon Web Services account that owns the local gateway route + // table. OwnerId *string `locationName:"ownerId" type:"string"` // The state of the local gateway route table. @@ -108616,7 +110001,8 @@ type LocalGatewayRouteTableVirtualInterfaceGroupAssociation struct { // The ID of the virtual interface group. LocalGatewayVirtualInterfaceGroupId *string `locationName:"localGatewayVirtualInterfaceGroupId" type:"string"` - // The AWS account ID that owns the local gateway virtual interface group association. + // The ID of the Amazon Web Services account that owns the local gateway virtual + // interface group association. OwnerId *string `locationName:"ownerId" type:"string"` // The state of the association. @@ -108708,7 +110094,8 @@ type LocalGatewayRouteTableVpcAssociation struct { // The ID of the association. LocalGatewayRouteTableVpcAssociationId *string `locationName:"localGatewayRouteTableVpcAssociationId" type:"string"` - // The AWS account ID that owns the local gateway route table for the association. + // The ID of the Amazon Web Services account that owns the local gateway route + // table for the association. OwnerId *string `locationName:"ownerId" type:"string"` // The state of the association. @@ -108804,7 +110191,8 @@ type LocalGatewayVirtualInterface struct { // The ID of the virtual interface. LocalGatewayVirtualInterfaceId *string `locationName:"localGatewayVirtualInterfaceId" type:"string"` - // The AWS account ID that owns the local gateway virtual interface. + // The ID of the Amazon Web Services account that owns the local gateway virtual + // interface. OwnerId *string `locationName:"ownerId" type:"string"` // The peer address. @@ -108905,7 +110293,8 @@ type LocalGatewayVirtualInterfaceGroup struct { // The IDs of the virtual interfaces. LocalGatewayVirtualInterfaceIds []*string `locationName:"localGatewayVirtualInterfaceIdSet" locationNameList:"item" type:"list"` - // The AWS account ID that owns the local gateway virtual interface group. + // The ID of the Amazon Web Services account that owns the local gateway virtual + // interface group. OwnerId *string `locationName:"ownerId" type:"string"` // The tags assigned to the virtual interface group. @@ -109219,9 +110608,9 @@ type ModifyAvailabilityZoneGroupInput struct { GroupName *string `type:"string" required:"true"` // Indicates whether you are opted in to the Local Zone group or Wavelength - // Zone group. The only valid value is opted-in. You must contact AWS Support - // (https://console.aws.amazon.com/support/home#/case/create%3FissueType=customer-service%26serviceCode=general-info%26getting-started%26categoryCode=using-aws%26services) - // to opt out of a Local Zone group, or Wavelength Zone group. + // Zone group. The only valid value is opted-in. You must contact Amazon Web + // Services Support (https://console.aws.amazon.com/support/home#/case/create%3FissueType=customer-service%26serviceCode=general-info%26getting-started%26categoryCode=using-aws%26services) + // to opt out of a Local Zone or Wavelength Zone group. // // OptInStatus is a required field OptInStatus *string `type:"string" required:"true" enum:"ModifyAvailabilityZoneOptInStatus"` @@ -109310,6 +110699,141 @@ func (s *ModifyAvailabilityZoneGroupOutput) SetReturn(v bool) *ModifyAvailabilit return s } +type ModifyCapacityReservationFleetInput struct { + _ struct{} `type:"structure"` + + // The ID of the Capacity Reservation Fleet to modify. + // + // CapacityReservationFleetId is a required field + CapacityReservationFleetId *string `type:"string" required:"true"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The date and time at which the Capacity Reservation Fleet expires. When the + // Capacity Reservation Fleet expires, its state changes to expired and all + // of the Capacity Reservations in the Fleet expire. + // + // The Capacity Reservation Fleet expires within an hour after the specified + // time. For example, if you specify 5/31/2019, 13:30:55, the Capacity Reservation + // Fleet is guaranteed to expire between 13:30:55 and 14:30:55 on 5/31/2019. + // + // You can't specify EndDate and RemoveEndDate in the same request. + EndDate *time.Time `type:"timestamp"` + + // Indicates whether to remove the end date from the Capacity Reservation Fleet. + // If you remove the end date, the Capacity Reservation Fleet does not expire + // and it remains active until you explicitly cancel it using the CancelCapacityReservationFleet + // action. + // + // You can't specify RemoveEndDate and EndDate in the same request. + RemoveEndDate *bool `type:"boolean"` + + // The total number of capacity units to be reserved by the Capacity Reservation + // Fleet. This value, together with the instance type weights that you assign + // to each instance type used by the Fleet determine the number of instances + // for which the Fleet reserves capacity. Both values are based on units that + // make sense for your workload. For more information, see Total target capacity + // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/crfleet-concepts.html#target-capacity) + // in the Amazon EC2 User Guide. + TotalTargetCapacity *int64 `type:"integer"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ModifyCapacityReservationFleetInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ModifyCapacityReservationFleetInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyCapacityReservationFleetInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyCapacityReservationFleetInput"} + if s.CapacityReservationFleetId == nil { + invalidParams.Add(request.NewErrParamRequired("CapacityReservationFleetId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetCapacityReservationFleetId sets the CapacityReservationFleetId field's value. +func (s *ModifyCapacityReservationFleetInput) SetCapacityReservationFleetId(v string) *ModifyCapacityReservationFleetInput { + s.CapacityReservationFleetId = &v + return s +} + +// SetDryRun sets the DryRun field's value. +func (s *ModifyCapacityReservationFleetInput) SetDryRun(v bool) *ModifyCapacityReservationFleetInput { + s.DryRun = &v + return s +} + +// SetEndDate sets the EndDate field's value. +func (s *ModifyCapacityReservationFleetInput) SetEndDate(v time.Time) *ModifyCapacityReservationFleetInput { + s.EndDate = &v + return s +} + +// SetRemoveEndDate sets the RemoveEndDate field's value. +func (s *ModifyCapacityReservationFleetInput) SetRemoveEndDate(v bool) *ModifyCapacityReservationFleetInput { + s.RemoveEndDate = &v + return s +} + +// SetTotalTargetCapacity sets the TotalTargetCapacity field's value. +func (s *ModifyCapacityReservationFleetInput) SetTotalTargetCapacity(v int64) *ModifyCapacityReservationFleetInput { + s.TotalTargetCapacity = &v + return s +} + +type ModifyCapacityReservationFleetOutput struct { + _ struct{} `type:"structure"` + + // Returns true if the request succeeds; otherwise, it returns an error. + Return *bool `locationName:"return" type:"boolean"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ModifyCapacityReservationFleetOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ModifyCapacityReservationFleetOutput) GoString() string { + return s.String() +} + +// SetReturn sets the Return field's value. +func (s *ModifyCapacityReservationFleetOutput) SetReturn(v bool) *ModifyCapacityReservationFleetOutput { + s.Return = &v + return s +} + type ModifyCapacityReservationInput struct { _ struct{} `type:"structure"` @@ -110044,8 +111568,8 @@ type ModifyFpgaImageAttributeInput struct { // attribute. UserGroups []*string `locationName:"UserGroup" locationNameList:"UserGroup" type:"list"` - // The AWS account IDs. This parameter is valid only when modifying the loadPermission - // attribute. + // The Amazon Web Services account IDs. This parameter is valid only when modifying + // the loadPermission attribute. UserIds []*string `locationName:"UserId" locationNameList:"UserId" type:"list"` } @@ -112817,7 +114341,7 @@ type ModifyTrafficMirrorFilterRuleInput struct { // The port range to assign to the Traffic Mirror rule. SourcePortRange *TrafficMirrorPortRangeRequest `type:"structure"` - // The type of traffic (ingress | egress) to assign to the rule. + // The type of traffic to assign to the rule. TrafficDirection *string `type:"string" enum:"TrafficDirection"` // The ID of the Traffic Mirror rule. @@ -121544,14 +123068,13 @@ type ReleaseAddressInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The set of Availability Zones, Local Zones, or Wavelength Zones from which - // AWS advertises IP addresses. + // Amazon Web Services advertises IP addresses. // - // If you provide an incorrect network border group, you will receive an InvalidAddress.NotFound - // error. For more information, see Error Codes (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html). + // If you provide an incorrect network border group, you receive an InvalidAddress.NotFound + // error. // // You cannot use a network border group with EC2 Classic. If you attempt this - // operation on EC2 classic, you will receive an InvalidParameterCombination - // error. For more information, see Error Codes (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html). + // operation on EC2 classic, you receive an InvalidParameterCombination error. NetworkBorderGroup *string `type:"string"` // [EC2-Classic] The Elastic IP address. Required for EC2-Classic. @@ -123788,6 +125311,125 @@ func (s *Reservation) SetReservationId(v string) *Reservation { return s } +// Information about an instance type to use in a Capacity Reservation Fleet. +type ReservationFleetInstanceSpecification struct { + _ struct{} `type:"structure"` + + // The Availability Zone in which the Capacity Reservation Fleet reserves the + // capacity. A Capacity Reservation Fleet can't span Availability Zones. All + // instance type specifications that you specify for the Fleet must use the + // same Availability Zone. + AvailabilityZone *string `type:"string"` + + // The ID of the Availability Zone in which the Capacity Reservation Fleet reserves + // the capacity. A Capacity Reservation Fleet can't span Availability Zones. + // All instance type specifications that you specify for the Fleet must use + // the same Availability Zone. + AvailabilityZoneId *string `type:"string"` + + // Indicates whether the Capacity Reservation Fleet supports EBS-optimized instances + // types. This optimization provides dedicated throughput to Amazon EBS and + // an optimized configuration stack to provide optimal I/O performance. This + // optimization isn't available with all instance types. Additional usage charges + // apply when using EBS-optimized instance types. + EbsOptimized *bool `type:"boolean"` + + // The type of operating system for which the Capacity Reservation Fleet reserves + // capacity. + InstancePlatform *string `type:"string" enum:"CapacityReservationInstancePlatform"` + + // The instance type for which the Capacity Reservation Fleet reserves capacity. + InstanceType *string `type:"string" enum:"InstanceType"` + + // The priority to assign to the instance type. This value is used to determine + // which of the instance types specified for the Fleet should be prioritized + // for use. A lower value indicates a high priority. For more information, see + // Instance type priority (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/crfleet-concepts.html#instance-priority) + // in the Amazon EC2 User Guide. + Priority *int64 `type:"integer"` + + // The number of capacity units provided by the specified instance type. This + // value, together with the total target capacity that you specify for the Fleet + // determine the number of instances for which the Fleet reserves capacity. + // Both values are based on units that make sense for your workload. For more + // information, see Total target capacity (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/crfleet-concepts.html#target-capacity) + // in the Amazon EC2 User Guide. + Weight *float64 `min:"0.001" type:"double"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ReservationFleetInstanceSpecification) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ReservationFleetInstanceSpecification) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ReservationFleetInstanceSpecification) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ReservationFleetInstanceSpecification"} + if s.Weight != nil && *s.Weight < 0.001 { + invalidParams.Add(request.NewErrParamMinValue("Weight", 0.001)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAvailabilityZone sets the AvailabilityZone field's value. +func (s *ReservationFleetInstanceSpecification) SetAvailabilityZone(v string) *ReservationFleetInstanceSpecification { + s.AvailabilityZone = &v + return s +} + +// SetAvailabilityZoneId sets the AvailabilityZoneId field's value. +func (s *ReservationFleetInstanceSpecification) SetAvailabilityZoneId(v string) *ReservationFleetInstanceSpecification { + s.AvailabilityZoneId = &v + return s +} + +// SetEbsOptimized sets the EbsOptimized field's value. +func (s *ReservationFleetInstanceSpecification) SetEbsOptimized(v bool) *ReservationFleetInstanceSpecification { + s.EbsOptimized = &v + return s +} + +// SetInstancePlatform sets the InstancePlatform field's value. +func (s *ReservationFleetInstanceSpecification) SetInstancePlatform(v string) *ReservationFleetInstanceSpecification { + s.InstancePlatform = &v + return s +} + +// SetInstanceType sets the InstanceType field's value. +func (s *ReservationFleetInstanceSpecification) SetInstanceType(v string) *ReservationFleetInstanceSpecification { + s.InstanceType = &v + return s +} + +// SetPriority sets the Priority field's value. +func (s *ReservationFleetInstanceSpecification) SetPriority(v int64) *ReservationFleetInstanceSpecification { + s.Priority = &v + return s +} + +// SetWeight sets the Weight field's value. +func (s *ReservationFleetInstanceSpecification) SetWeight(v float64) *ReservationFleetInstanceSpecification { + s.Weight = &v + return s +} + // The cost associated with the Reserved Instance. type ReservationValue struct { _ struct{} `type:"structure"` @@ -128638,9 +130280,7 @@ type SearchLocalGatewayRoutesInput struct { DryRun *bool `type:"boolean"` // One or more filters. - // - // Filters is a required field - Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list" required:"true"` + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` // The ID of the local gateway route table. // @@ -128676,9 +130316,6 @@ func (s SearchLocalGatewayRoutesInput) GoString() string { // Validate inspects the fields of the type to determine if they are valid. func (s *SearchLocalGatewayRoutesInput) Validate() error { invalidParams := request.ErrInvalidParams{Context: "SearchLocalGatewayRoutesInput"} - if s.Filters == nil { - invalidParams.Add(request.NewErrParamRequired("Filters")) - } if s.LocalGatewayRouteTableId == nil { invalidParams.Add(request.NewErrParamRequired("LocalGatewayRouteTableId")) } @@ -129678,8 +131315,8 @@ func (s SendDiagnosticInterruptOutput) GoString() string { type ServiceConfiguration struct { _ struct{} `type:"structure"` - // Indicates whether requests from other AWS accounts to create an endpoint - // to the service must first be accepted. + // Indicates whether requests from other Amazon Web Services accounts to create + // an endpoint to the service must first be accepted. AcceptanceRequired *bool `locationName:"acceptanceRequired" type:"boolean"` // The Availability Zones in which the service is available. @@ -129834,7 +131471,7 @@ type ServiceDetail struct { // service VPC endpoints using the VPC endpoint API is restricted. ManagesVpcEndpoints *bool `locationName:"managesVpcEndpoints" type:"boolean"` - // The AWS account ID of the service owner. + // The Amazon Web Services account ID of the service owner. Owner *string `locationName:"owner" type:"string"` // The private DNS name for the service. @@ -133762,22 +135399,7 @@ func (s *TagDescription) SetValue(v string) *TagDescription { type TagSpecification struct { _ struct{} `type:"structure"` - // The type of resource to tag on creation. The possible values are: capacity-reservation - // | carrier-gateway | client-vpn-endpoint | customer-gateway | dedicated-host - // | dhcp-options | egress-only-internet-gateway | elastic-gpu | elastic-ip - // | export-image-task | export-instance-task | fleet | fpga-image | host-reservation - // | image | import-image-task | import-snapshot-task | instance | instance-event-window - // | internet-gateway | ipv4pool-ec2 | ipv6pool-ec2 | key-pair | launch-template - // | local-gateway-route-table-vpc-association | natgateway | network-acl | - // network-insights-analysis | network-insights-path | network-interface | placement-group - // | prefix-list | reserved-instances | route-table | security-group | security-group-rule - // | snapshot | spot-fleet-request | spot-instances-request | subnet | traffic-mirror-filter - // | traffic-mirror-session | traffic-mirror-target | transit-gateway | transit-gateway-attachment - // | transit-gateway-multicast-domain | transit-gateway-route-table | volume - // | vpc | vpc-endpoint | vpc-endpoint-service | vpc-flow-log | vpc-peering-connection - // | vpn-connection | vpn-gateway. - // - // To tag a resource after it has been created, see CreateTags (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTags.html). + // The type of resource to tag on creation. ResourceType *string `locationName:"resourceType" type:"string" enum:"ResourceType"` // The tags to apply to the resource. @@ -139890,7 +141512,7 @@ type VpcEndpoint struct { // (Interface endpoint) One or more network interfaces for the endpoint. NetworkInterfaceIds []*string `locationName:"networkInterfaceIdSet" locationNameList:"item" type:"list"` - // The ID of the AWS account that owns the VPC endpoint. + // The ID of the Amazon Web Services account that owns the VPC endpoint. OwnerId *string `locationName:"ownerId" type:"string"` // The policy document associated with the endpoint, if applicable. @@ -140070,7 +141692,7 @@ type VpcEndpointConnection struct { // The ID of the VPC endpoint. VpcEndpointId *string `locationName:"vpcEndpointId" type:"string"` - // The AWS account ID of the owner of the VPC endpoint. + // The ID of the Amazon Web Services account that owns the VPC endpoint. VpcEndpointOwner *string `locationName:"vpcEndpointOwner" type:"string"` // The state of the VPC endpoint. @@ -140160,7 +141782,8 @@ type VpcIpv6CidrBlockAssociation struct { Ipv6Pool *string `locationName:"ipv6Pool" type:"string"` // The name of the unique set of Availability Zones, Local Zones, or Wavelength - // Zones from which AWS advertises IP addresses, for example, us-east-1-wl1-bos-wlz-1. + // Zones from which Amazon Web Services advertises IP addresses, for example, + // us-east-1-wl1-bos-wlz-1. NetworkBorderGroup *string `locationName:"networkBorderGroup" type:"string"` } @@ -141965,6 +143588,50 @@ func CancelSpotInstanceRequestState_Values() []string { } } +const ( + // CapacityReservationFleetStateSubmitted is a CapacityReservationFleetState enum value + CapacityReservationFleetStateSubmitted = "submitted" + + // CapacityReservationFleetStateModifying is a CapacityReservationFleetState enum value + CapacityReservationFleetStateModifying = "modifying" + + // CapacityReservationFleetStateActive is a CapacityReservationFleetState enum value + CapacityReservationFleetStateActive = "active" + + // CapacityReservationFleetStatePartiallyFulfilled is a CapacityReservationFleetState enum value + CapacityReservationFleetStatePartiallyFulfilled = "partially_fulfilled" + + // CapacityReservationFleetStateExpiring is a CapacityReservationFleetState enum value + CapacityReservationFleetStateExpiring = "expiring" + + // CapacityReservationFleetStateExpired is a CapacityReservationFleetState enum value + CapacityReservationFleetStateExpired = "expired" + + // CapacityReservationFleetStateCancelling is a CapacityReservationFleetState enum value + CapacityReservationFleetStateCancelling = "cancelling" + + // CapacityReservationFleetStateCancelled is a CapacityReservationFleetState enum value + CapacityReservationFleetStateCancelled = "cancelled" + + // CapacityReservationFleetStateFailed is a CapacityReservationFleetState enum value + CapacityReservationFleetStateFailed = "failed" +) + +// CapacityReservationFleetState_Values returns all elements of the CapacityReservationFleetState enum +func CapacityReservationFleetState_Values() []string { + return []string{ + CapacityReservationFleetStateSubmitted, + CapacityReservationFleetStateModifying, + CapacityReservationFleetStateActive, + CapacityReservationFleetStatePartiallyFulfilled, + CapacityReservationFleetStateExpiring, + CapacityReservationFleetStateExpired, + CapacityReservationFleetStateCancelling, + CapacityReservationFleetStateCancelled, + CapacityReservationFleetStateFailed, + } +} + const ( // CapacityReservationInstancePlatformLinuxUnix is a CapacityReservationInstancePlatform enum value CapacityReservationInstancePlatformLinuxUnix = "Linux/UNIX" @@ -142869,6 +144536,18 @@ func FleetActivityStatus_Values() []string { } } +const ( + // FleetCapacityReservationTenancyDefault is a FleetCapacityReservationTenancy enum value + FleetCapacityReservationTenancyDefault = "default" +) + +// FleetCapacityReservationTenancy_Values returns all elements of the FleetCapacityReservationTenancy enum +func FleetCapacityReservationTenancy_Values() []string { + return []string{ + FleetCapacityReservationTenancyDefault, + } +} + const ( // FleetCapacityReservationUsageStrategyUseCapacityReservationsFirst is a FleetCapacityReservationUsageStrategy enum value FleetCapacityReservationUsageStrategyUseCapacityReservationsFirst = "use-capacity-reservations-first" @@ -142917,6 +144596,18 @@ func FleetExcessCapacityTerminationPolicy_Values() []string { } } +const ( + // FleetInstanceMatchCriteriaOpen is a FleetInstanceMatchCriteria enum value + FleetInstanceMatchCriteriaOpen = "open" +) + +// FleetInstanceMatchCriteria_Values returns all elements of the FleetInstanceMatchCriteria enum +func FleetInstanceMatchCriteria_Values() []string { + return []string{ + FleetInstanceMatchCriteriaOpen, + } +} + const ( // FleetOnDemandAllocationStrategyLowestPrice is a FleetOnDemandAllocationStrategy enum value FleetOnDemandAllocationStrategyLowestPrice = "lowest-price" diff --git a/vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go index 15b26e741..b459717ff 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go @@ -1030,6 +1030,11 @@ func (c *EC2) WaitUntilSnapshotCompletedWithContext(ctx aws.Context, input *Desc Matcher: request.PathAllWaiterMatch, Argument: "Snapshots[].State", Expected: "completed", }, + { + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Snapshots[].State", + Expected: "error", + }, }, Logger: c.Config.Logger, NewRequest: func(opts []request.Option) (*request.Request, error) { diff --git a/vendor/github.com/aws/aws-sdk-go/service/sso/api.go b/vendor/github.com/aws/aws-sdk-go/service/sso/api.go index e3711e642..c648e7819 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/sso/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/sso/api.go @@ -550,7 +550,7 @@ func (s *AccountInfo) SetEmailAddress(v string) *AccountInfo { } type GetRoleCredentialsInput struct { - _ struct{} `type:"structure"` + _ struct{} `type:"structure" nopayload:"true"` // The token issued by the CreateToken API call. For more information, see CreateToken // (https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html) @@ -726,7 +726,7 @@ func (s *InvalidRequestException) RequestID() string { } type ListAccountRolesInput struct { - _ struct{} `type:"structure"` + _ struct{} `type:"structure" nopayload:"true"` // The token issued by the CreateToken API call. For more information, see CreateToken // (https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html) @@ -855,7 +855,7 @@ func (s *ListAccountRolesOutput) SetRoleList(v []*RoleInfo) *ListAccountRolesOut } type ListAccountsInput struct { - _ struct{} `type:"structure"` + _ struct{} `type:"structure" nopayload:"true"` // The token issued by the CreateToken API call. For more information, see CreateToken // (https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html) @@ -970,7 +970,7 @@ func (s *ListAccountsOutput) SetNextToken(v string) *ListAccountsOutput { } type LogoutInput struct { - _ struct{} `type:"structure"` + _ struct{} `type:"structure" nopayload:"true"` // The token issued by the CreateToken API call. For more information, see CreateToken // (https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html) @@ -1022,7 +1022,7 @@ func (s *LogoutInput) SetAccessToken(v string) *LogoutInput { } type LogoutOutput struct { - _ struct{} `type:"structure"` + _ struct{} `type:"structure" nopayload:"true"` } // String returns the string representation. diff --git a/vendor/modules.txt b/vendor/modules.txt index ebbf320f8..992b1c58b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,4 +1,4 @@ -# github.com/aws/aws-sdk-go v1.40.55 +# github.com/aws/aws-sdk-go v1.41.0 ## explicit github.com/aws/aws-sdk-go/aws github.com/aws/aws-sdk-go/aws/awserr From 3934599b0e234835fab806659a89eaca080f7993 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Oct 2021 06:54:40 +0000 Subject: [PATCH 11/18] rebase: bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5. - [Release notes](https://github.com/onsi/ginkgo/releases) - [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md) - [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5) --- updated-dependencies: - dependency-name: github.com/onsi/ginkgo dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 3 ++- vendor/github.com/onsi/ginkgo/CHANGELOG.md | 7 +++++++ vendor/github.com/onsi/ginkgo/README.md | 13 ++++-------- .../github.com/onsi/ginkgo/config/config.go | 2 +- vendor/github.com/onsi/ginkgo/ginkgo_dsl.go | 11 ++++++++-- vendor/github.com/onsi/ginkgo/go.mod | 2 +- .../internal/testingtproxy/testing_t_proxy.go | 5 +++++ .../onsi/ginkgo/types/deprecation_support.go | 20 ++++++++++++++----- vendor/modules.txt | 2 +- 10 files changed, 46 insertions(+), 21 deletions(-) diff --git a/go.mod b/go.mod index f56e2d115..4f15fb382 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/kubernetes-csi/csi-lib-utils v0.10.0 github.com/kubernetes-csi/external-snapshotter/client/v4 v4.2.0 github.com/libopenstorage/secrets v0.0.0-20210908194121-a1d19aa9713a - github.com/onsi/ginkgo v1.16.4 + github.com/onsi/ginkgo v1.16.5 github.com/onsi/gomega v1.16.0 github.com/pborman/uuid v1.2.1 github.com/prometheus/client_golang v1.11.0 diff --git a/go.sum b/go.sum index f45c5fcd9..25065714c 100644 --- a/go.sum +++ b/go.sum @@ -786,8 +786,9 @@ github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= diff --git a/vendor/github.com/onsi/ginkgo/CHANGELOG.md b/vendor/github.com/onsi/ginkgo/CHANGELOG.md index 494abdbfb..a26bc530f 100644 --- a/vendor/github.com/onsi/ginkgo/CHANGELOG.md +++ b/vendor/github.com/onsi/ginkgo/CHANGELOG.md @@ -1,3 +1,10 @@ +## 1.16.5 + +Ginkgo 2.0 now has a Release Candidate. 1.16.5 advertises the existence of the RC. +1.16.5 deprecates GinkgoParallelNode in favor of GinkgoParallelProcess + +You can silence the RC advertisement by setting an `ACK_GINKG_RC=true` environment variable or creating a file in your home directory called `.ack-ginkgo-rc` + ## 1.16.4 ### Fixes diff --git a/vendor/github.com/onsi/ginkgo/README.md b/vendor/github.com/onsi/ginkgo/README.md index 05321e6ea..a25ca5e03 100644 --- a/vendor/github.com/onsi/ginkgo/README.md +++ b/vendor/github.com/onsi/ginkgo/README.md @@ -1,23 +1,18 @@ ![Ginkgo: A Go BDD Testing Framework](https://onsi.github.io/ginkgo/images/ginkgo.png) -[![Build Status](https://travis-ci.org/onsi/ginkgo.svg?branch=master)](https://travis-ci.org/onsi/ginkgo) [![test](https://github.com/onsi/ginkgo/workflows/test/badge.svg?branch=master)](https://github.com/onsi/ginkgo/actions?query=workflow%3Atest+branch%3Amaster) Jump to the [docs](https://onsi.github.io/ginkgo/) | [中文文档](https://ke-chain.github.io/ginkgodoc) to learn more. To start rolling your Ginkgo tests *now* [keep reading](#set-me-up)! If you have a question, comment, bug report, feature request, etc. please open a GitHub issue, or visit the [Ginkgo Slack channel](https://app.slack.com/client/T029RQSE6/CQQ50BBNW). -# Ginkgo 2.0 is coming soon! +# Ginkgo 2.0 Release Candidate is available! -An effort is underway to develop and deliver Ginkgo 2.0. The work is happening in the [v2](https://github.com/onsi/ginkgo/tree/v2) branch and a changelog and migration guide is being maintained on that branch [here](https://github.com/onsi/ginkgo/blob/v2/docs/MIGRATING_TO_V2.md). Issue [#711](https://github.com/onsi/ginkgo/issues/711) is the central place for discussion and links to the original [proposal doc](https://docs.google.com/document/d/1h28ZknXRsTLPNNiOjdHIO-F2toCzq4xoZDXbfYaBdoQ/edit#). +An effort is underway to develop and deliver Ginkgo 2.0. The work is happening in the [ver2](https://github.com/onsi/ginkgo/tree/ver2) branch and a changelog and migration guide is being maintained on that branch [here](https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md). Issue [#711](https://github.com/onsi/ginkgo/issues/711) is the central place for discussion. -As described in the [changelog](https://github.com/onsi/ginkgo/blob/v2/docs/MIGRATING_TO_V2.md) and [proposal](https://docs.google.com/document/d/1h28ZknXRsTLPNNiOjdHIO-F2toCzq4xoZDXbfYaBdoQ/edit#), Ginkgo 2.0 will clean up the Ginkgo codebase, deprecate and remove some v1 functionality, and add several new much-requested features. To help users get ready for the migration, Ginkgo v1 has started emitting deprecation warnings for features that will no longer be supported with links to documentation for how to migrate away from these features. If you have concerns or comments please chime in on [#711](https://github.com/onsi/ginkgo/issues/711). +As described in the [changelog](https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md) and [proposal](https://docs.google.com/document/d/1h28ZknXRsTLPNNiOjdHIO-F2toCzq4xoZDXbfYaBdoQ/edit#), Ginkgo 2.0 will clean up the Ginkgo codebase, deprecate and remove some v1 functionality, and add several new much-requested features. To help users get ready for the migration, Ginkgo v1 has started emitting deprecation warnings for features that will no longer be supported with links to documentation for how to migrate away from these features. If you have concerns or comments please chime in on [#711](https://github.com/onsi/ginkgo/issues/711). -The current timeline for completion of 2.0 looks like: - -- Early April 2021: first public release of 2.0, deprecation warnings land in v1. -- May 2021: first beta/rc of 2.0 with most new functionality in place. -- June/July 2021: 2.0 ships and fully replaces the 1.x codebase on master. +Please start exploring and using the V2 release! To get started follow the [Using the Release Candidate](https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md#using-the-beta) directions in the migration guide. ## TLDR Ginkgo builds on Go's `testing` package, allowing expressive [Behavior-Driven Development](https://en.wikipedia.org/wiki/Behavior-driven_development) ("BDD") style tests. diff --git a/vendor/github.com/onsi/ginkgo/config/config.go b/vendor/github.com/onsi/ginkgo/config/config.go index 5f3f43969..3130c7789 100644 --- a/vendor/github.com/onsi/ginkgo/config/config.go +++ b/vendor/github.com/onsi/ginkgo/config/config.go @@ -20,7 +20,7 @@ import ( "fmt" ) -const VERSION = "1.16.4" +const VERSION = "1.16.5" type GinkgoConfigType struct { RandomSeed int64 diff --git a/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go b/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go index 4a6e1e1ee..ccd7685e3 100644 --- a/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go +++ b/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go @@ -73,9 +73,15 @@ func GinkgoRandomSeed() int64 { return config.GinkgoConfig.RandomSeed } -//GinkgoParallelNode returns the parallel node number for the current ginkgo process -//The node number is 1-indexed +//GinkgoParallelNode is deprecated, use GinkgoParallelProcess instead func GinkgoParallelNode() int { + deprecationTracker.TrackDeprecation(types.Deprecations.ParallelNode(), codelocation.New(1)) + return GinkgoParallelProcess() +} + +//GinkgoParallelProcess returns the parallel process number for the current ginkgo process +//The process number is 1-indexed +func GinkgoParallelProcess() int { return config.GinkgoConfig.ParallelNode } @@ -109,6 +115,7 @@ func GinkgoT(optionalOffset ...int) GinkgoTInterface { //in the testing package's T. type GinkgoTInterface interface { Cleanup(func()) + Setenv(key, value string) Error(args ...interface{}) Errorf(format string, args ...interface{}) Fail() diff --git a/vendor/github.com/onsi/ginkgo/go.mod b/vendor/github.com/onsi/ginkgo/go.mod index 86a5a97be..171144326 100644 --- a/vendor/github.com/onsi/ginkgo/go.mod +++ b/vendor/github.com/onsi/ginkgo/go.mod @@ -1,6 +1,6 @@ module github.com/onsi/ginkgo -go 1.15 +go 1.16 require ( github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 diff --git a/vendor/github.com/onsi/ginkgo/internal/testingtproxy/testing_t_proxy.go b/vendor/github.com/onsi/ginkgo/internal/testingtproxy/testing_t_proxy.go index d7bbb7a96..4dcfaf4cd 100644 --- a/vendor/github.com/onsi/ginkgo/internal/testingtproxy/testing_t_proxy.go +++ b/vendor/github.com/onsi/ginkgo/internal/testingtproxy/testing_t_proxy.go @@ -34,6 +34,11 @@ func (t *ginkgoTestingTProxy) Cleanup(func()) { // No-op } +func (t *ginkgoTestingTProxy) Setenv(kev, value string) { + fmt.Println("Setenv is a noop for Ginkgo at the moment but will be implemented in V2") + // No-op until Cleanup is implemented +} + func (t *ginkgoTestingTProxy) Error(args ...interface{}) { t.fail(fmt.Sprintln(args...), t.offset) } diff --git a/vendor/github.com/onsi/ginkgo/types/deprecation_support.go b/vendor/github.com/onsi/ginkgo/types/deprecation_support.go index 305c134b7..d5a6658f3 100644 --- a/vendor/github.com/onsi/ginkgo/types/deprecation_support.go +++ b/vendor/github.com/onsi/ginkgo/types/deprecation_support.go @@ -52,6 +52,14 @@ func (d deprecations) Measure() Deprecation { } } +func (d deprecations) ParallelNode() Deprecation { + return Deprecation{ + Message: "GinkgoParallelNode is deprecated and will be removed in Ginkgo V2. Please use GinkgoParallelProcess instead.", + DocLink: "renamed-ginkgoparallelnode", + Version: "1.16.5", + } +} + func (d deprecations) Convert() Deprecation { return Deprecation{ Message: "The convert command is deprecated in Ginkgo V2", @@ -99,16 +107,18 @@ func (d *DeprecationTracker) DidTrackDeprecations() bool { } func (d *DeprecationTracker) DeprecationsReport() string { - out := formatter.F("{{light-yellow}}You're using deprecated Ginkgo functionality:{{/}}\n") + out := formatter.F("\n{{light-yellow}}You're using deprecated Ginkgo functionality:{{/}}\n") out += formatter.F("{{light-yellow}}============================================={{/}}\n") - out += formatter.F("Ginkgo 2.0 is under active development and will introduce (a small number of) breaking changes.\n") - out += formatter.F("To learn more, view the migration guide at {{cyan}}{{underline}}https://github.com/onsi/ginkgo/blob/v2/docs/MIGRATING_TO_V2.md{{/}}\n") - out += formatter.F("To comment, chime in at {{cyan}}{{underline}}https://github.com/onsi/ginkgo/issues/711{{/}}\n\n") + out += formatter.F("{{bold}}{{green}}Ginkgo 2.0{{/}} is under active development and will introduce several new features, improvements, and a small handful of breaking changes.\n") + out += formatter.F("A release candidate for 2.0 is now available and 2.0 should GA in Fall 2021. {{bold}}Please give the RC a try and send us feedback!{{/}}\n") + out += formatter.F(" - To learn more, view the migration guide at {{cyan}}{{underline}}https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md{{/}}\n") + out += formatter.F(" - For instructions on using the Release Candidate visit {{cyan}}{{underline}}https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md#using-the-beta{{/}}\n") + out += formatter.F(" - To comment, chime in at {{cyan}}{{underline}}https://github.com/onsi/ginkgo/issues/711{{/}}\n\n") for deprecation, locations := range d.deprecations { out += formatter.Fi(1, "{{yellow}}"+deprecation.Message+"{{/}}\n") if deprecation.DocLink != "" { - out += formatter.Fi(1, "{{bold}}Learn more at:{{/}} {{cyan}}{{underline}}https://github.com/onsi/ginkgo/blob/v2/docs/MIGRATING_TO_V2.md#%s{{/}}\n", deprecation.DocLink) + out += formatter.Fi(1, "{{bold}}Learn more at:{{/}} {{cyan}}{{underline}}https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md#%s{{/}}\n", deprecation.DocLink) } for _, location := range locations { out += formatter.Fi(2, "{{gray}}%s{{/}}\n", location) diff --git a/vendor/modules.txt b/vendor/modules.txt index 992b1c58b..8b0257647 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -225,7 +225,7 @@ github.com/nxadm/tail/ratelimiter github.com/nxadm/tail/util github.com/nxadm/tail/watch github.com/nxadm/tail/winfile -# github.com/onsi/ginkgo v1.16.4 +# github.com/onsi/ginkgo v1.16.5 ## explicit github.com/onsi/ginkgo github.com/onsi/ginkgo/config From 0abd2e785c9627ae878e886ec87cb08aa8ff4061 Mon Sep 17 00:00:00 2001 From: Rakshith R Date: Thu, 14 Oct 2021 14:42:29 +0530 Subject: [PATCH 12/18] e2e: increase E2E_TIMEOUT to 120m This commit increases E2E_TIMEOUT to 120m, to avoid frequent test fails due to timeout. Signed-off-by: Rakshith R --- build.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.env b/build.env index e2195d41f..b6711e9e1 100644 --- a/build.env +++ b/build.env @@ -59,5 +59,5 @@ CSI_NODE_DRIVER_REGISTRAR_VERSION=v2.3.0 # - enable CEPH_CSI_RUN_ALL_TESTS when running tests with if it has root # permissions on the host #CEPH_CSI_RUN_ALL_TESTS=true -E2E_TIMEOUT=90m +E2E_TIMEOUT=120m DEPLOY_TIMEOUT=10 From f9c369918cfa9b6cb358a34a4ff456a7a68ce0e1 Mon Sep 17 00:00:00 2001 From: Rakshith R Date: Thu, 14 Oct 2021 11:57:35 +0530 Subject: [PATCH 13/18] ci: disable rook deployed csi drivers to speed up e2e Signed-off-by: Rakshith R --- scripts/rook.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/rook.sh b/scripts/rook.sh index f71c45627..aae815dc2 100755 --- a/scripts/rook.sh +++ b/scripts/rook.sh @@ -42,22 +42,28 @@ function deploy_rook() { then kubectl_retry create -f "${ROOK_URL}/crds.yaml" fi - kubectl_retry create -f "${ROOK_URL}/operator.yaml" + TEMP_DIR="$(mktemp -d)" + curl -o "${TEMP_DIR}/operator.yaml" "${ROOK_URL}/operator.yaml" + # disable rook deployed csi drivers + sed -i 's|ROOK_CSI_ENABLE_CEPHFS: "true"|ROOK_CSI_ENABLE_CEPHFS: "false"|g' "${TEMP_DIR}/operator.yaml" + sed -i 's|ROOK_CSI_ENABLE_RBD: "true"|ROOK_CSI_ENABLE_RBD: "false"|g' "${TEMP_DIR}/operator.yaml" + + kubectl_retry create -f "${TEMP_DIR}/operator.yaml" # Override the ceph version which rook installs by default. if [ -z "${ROOK_CEPH_CLUSTER_IMAGE}" ] then kubectl_retry create -f "${ROOK_URL}/cluster-test.yaml" else ROOK_CEPH_CLUSTER_VERSION_IMAGE_PATH="image: ${ROOK_CEPH_CLUSTER_IMAGE}" - TEMP_DIR="$(mktemp -d)" + curl -o "${TEMP_DIR}"/cluster-test.yaml "${ROOK_URL}/cluster-test.yaml" sed -i "s|image.*|${ROOK_CEPH_CLUSTER_VERSION_IMAGE_PATH}|g" "${TEMP_DIR}"/cluster-test.yaml sed -i "s/config: |/config: |\n \[mon\]\n mon_warn_on_insecure_global_id_reclaim_allowed = false/g" "${TEMP_DIR}"/cluster-test.yaml sed -i "s/healthCheck:/healthCheck:\n livenessProbe:\n mon:\n disabled: true\n mgr:\n disabled: true\n mds:\n disabled: true/g" "${TEMP_DIR}"/cluster-test.yaml cat "${TEMP_DIR}"/cluster-test.yaml kubectl_retry create -f "${TEMP_DIR}/cluster-test.yaml" - rm -rf "${TEMP_DIR}" fi + rm -rf "${TEMP_DIR}" kubectl_retry create -f "${ROOK_URL}/toolbox.yaml" kubectl_retry create -f "${ROOK_URL}/filesystem-test.yaml" From 584d43a132322260f94857a793fc6bbb4fe87ea1 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Fri, 1 Oct 2021 15:05:56 +0200 Subject: [PATCH 14/18] deploy: move rbd/CSIDriver to API Signed-off-by: Niels de Vos --- api/deploy/kubernetes/doc.go | 20 +++++ api/deploy/kubernetes/rbd/csidriver.go | 74 +++++++++++++++++++ api/deploy/kubernetes/rbd/csidriver.yaml | 10 +++ api/deploy/kubernetes/rbd/csidriver_test.go | 38 ++++++++++ api/go.mod | 1 + deploy/Makefile | 7 +- deploy/rbd/kubernetes/csidriver.yaml | 10 ++- tools/yamlgen/main.go | 25 ++++--- .../api/deploy/kubernetes/rbd/csidriver.go | 74 +++++++++++++++++++ .../api/deploy/kubernetes/rbd/csidriver.yaml | 10 +++ vendor/modules.txt | 1 + 11 files changed, 258 insertions(+), 12 deletions(-) create mode 100644 api/deploy/kubernetes/doc.go create mode 100644 api/deploy/kubernetes/rbd/csidriver.go create mode 100644 api/deploy/kubernetes/rbd/csidriver.yaml create mode 100644 api/deploy/kubernetes/rbd/csidriver_test.go create mode 100644 vendor/github.com/ceph/ceph-csi/api/deploy/kubernetes/rbd/csidriver.go create mode 100644 vendor/github.com/ceph/ceph-csi/api/deploy/kubernetes/rbd/csidriver.yaml diff --git a/api/deploy/kubernetes/doc.go b/api/deploy/kubernetes/doc.go new file mode 100644 index 000000000..e4bd824b1 --- /dev/null +++ b/api/deploy/kubernetes/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2021 The Ceph-CSI Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package kubernetes contains functions to obtain standard and recommended +// deployment artifacts for Kubernetes. These artifacts can be used by +// automation tools that want to deploy Ceph-CSI. +package kubernetes diff --git a/api/deploy/kubernetes/rbd/csidriver.go b/api/deploy/kubernetes/rbd/csidriver.go new file mode 100644 index 000000000..2708e98a3 --- /dev/null +++ b/api/deploy/kubernetes/rbd/csidriver.go @@ -0,0 +1,74 @@ +/* +Copyright 2021 The Ceph-CSI Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package rbd + +import ( + "bytes" + _ "embed" + "fmt" + "text/template" + + "github.com/ghodss/yaml" + storagev1 "k8s.io/api/storage/v1" +) + +//go:embed csidriver.yaml +var csiDriver string + +type CSIDriverValues struct { + Name string +} + +var CSIDriverDefaults = CSIDriverValues{ + Name: "rbd.csi.ceph.com", +} + +// NewCSIDriver takes a driver name from the CSIDriverValues struct and relaces +// the value in the template. A CSIDriver object is returned which can be +// created in the Kubernetes cluster. +func NewCSIDriver(values CSIDriverValues) (*storagev1.CSIDriver, error) { + data, err := NewCSIDriverYAML(values) + if err != nil { + return nil, err + } + + driver := &storagev1.CSIDriver{} + err = yaml.Unmarshal([]byte(data), driver) + if err != nil { + return nil, fmt.Errorf("failed convert YAML to %T: %w", driver, err) + } + + return driver, nil +} + +// NewCSIDriverYAML takes a driver name from the CSIDriverValues struct and relaces +// the value in the template. A CSIDriver object in YAML is returned which can be +// created in the Kubernetes cluster. +func NewCSIDriverYAML(values CSIDriverValues) (string, error) { + var buf bytes.Buffer + + tmpl, err := template.New("CSIDriver").Parse(csiDriver) + if err != nil { + return "", fmt.Errorf("failed to parse template: %w", err) + } + err = tmpl.Execute(&buf, values) + if err != nil { + return "", fmt.Errorf("failed to replace values in template: %w", err) + } + + return buf.String(), nil +} diff --git a/api/deploy/kubernetes/rbd/csidriver.yaml b/api/deploy/kubernetes/rbd/csidriver.yaml new file mode 100644 index 000000000..4ab105dcc --- /dev/null +++ b/api/deploy/kubernetes/rbd/csidriver.yaml @@ -0,0 +1,10 @@ +--- +# if Kubernetes version is less than 1.18 change +# apiVersion to storage.k8s.io/v1beta1 +apiVersion: storage.k8s.io/v1 +kind: CSIDriver +metadata: + name: "{{ .Name }}" +spec: + attachRequired: true + podInfoOnMount: false diff --git a/api/deploy/kubernetes/rbd/csidriver_test.go b/api/deploy/kubernetes/rbd/csidriver_test.go new file mode 100644 index 000000000..b3f6e8236 --- /dev/null +++ b/api/deploy/kubernetes/rbd/csidriver_test.go @@ -0,0 +1,38 @@ +/* +Copyright 2021 The Ceph-CSI Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package rbd + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestNewCSIDriver(t *testing.T) { + driver, err := NewCSIDriver(CSIDriverDefaults) + + require.NoError(t, err) + require.NotNil(t, driver) + require.Equal(t, driver.Name, CSIDriverDefaults.Name) +} + +func TestNewCSIDriverYAML(t *testing.T) { + yaml, err := NewCSIDriverYAML(CSIDriverDefaults) + + require.NoError(t, err) + require.NotEqual(t, "", yaml) +} diff --git a/api/go.mod b/api/go.mod index faa19817c..8db6eff6b 100644 --- a/api/go.mod +++ b/api/go.mod @@ -6,4 +6,5 @@ require ( github.com/ghodss/yaml v1.0.0 github.com/openshift/api v0.0.0-20210927171657-636513e97fda github.com/stretchr/testify v1.7.0 + k8s.io/api v0.22.1 ) diff --git a/deploy/Makefile b/deploy/Makefile index 02fb2e4c4..d68bb8af5 100644 --- a/deploy/Makefile +++ b/deploy/Makefile @@ -13,7 +13,12 @@ # limitations under the License. .PHONY: all -all: scc.yaml +all: \ + scc.yaml \ + rbd/kubernetes/csidriver.yaml scc.yaml: ../api/deploy/ocp/scc.yaml ../api/deploy/ocp/scc.go $(MAKE) -C ../tools generate-deploy + +rbd/kubernetes/csidriver.yaml: ../api/deploy/kubernetes/rbd/csidriver.yaml ../api/deploy/kubernetes/rbd/csidriver.go + $(MAKE) -C ../tools generate-deploy diff --git a/deploy/rbd/kubernetes/csidriver.yaml b/deploy/rbd/kubernetes/csidriver.yaml index 18ab2bc77..ef0eb1390 100644 --- a/deploy/rbd/kubernetes/csidriver.yaml +++ b/deploy/rbd/kubernetes/csidriver.yaml @@ -1,10 +1,18 @@ --- +# +# /!\ DO NOT MODIFY THIS FILE +# +# This file has been automatically generated by Ceph-CSI yamlgen. +# The source for the contents can be found in the api/deploy directory, make +# your modifications there. +# +--- # if Kubernetes version is less than 1.18 change # apiVersion to storage.k8s.io/v1beta1 apiVersion: storage.k8s.io/v1 kind: CSIDriver metadata: - name: rbd.csi.ceph.com + name: "rbd.csi.ceph.com" spec: attachRequired: true podInfoOnMount: false diff --git a/tools/yamlgen/main.go b/tools/yamlgen/main.go index ae1c9bc5f..5bdfd5a4e 100644 --- a/tools/yamlgen/main.go +++ b/tools/yamlgen/main.go @@ -19,7 +19,9 @@ package main import ( "fmt" "os" + "reflect" + "github.com/ceph/ceph-csi/api/deploy/kubernetes/rbd" "github.com/ceph/ceph-csi/api/deploy/ocp" ) @@ -35,18 +37,20 @@ const header = `--- type deploymentArtifact struct { filename string - // FIXME: This is not dynamic enough for additional YAML generating - // functions. Need to look into typecasting the functions and passing - // interface{} instead of ocp.SecurityContextConstraintsValues. - yamlFunc func(ocp.SecurityContextConstraintsValues) (string, error) - defaults ocp.SecurityContextConstraintsValues + yamlFunc reflect.Value + defaults reflect.Value } var yamlArtifacts = []deploymentArtifact{ { "../deploy/scc.yaml", - ocp.NewSecurityContextConstraintsYAML, - ocp.SecurityContextConstraintsDefaults, + reflect.ValueOf(ocp.NewSecurityContextConstraintsYAML), + reflect.ValueOf(ocp.SecurityContextConstraintsDefaults), + }, + { + "../deploy/rbd/kubernetes/csidriver.yaml", + reflect.ValueOf(rbd.NewCSIDriverYAML), + reflect.ValueOf(rbd.CSIDriverDefaults), }, } @@ -69,9 +73,10 @@ func writeArtifact(artifact deploymentArtifact) { panic(fmt.Sprintf("failed to write header to %q: %v", artifact.filename, err)) } - data, err := artifact.yamlFunc(artifact.defaults) - if err != nil { - panic(fmt.Sprintf("failed to generate YAML for %q: %v", artifact.filename, err)) + result := artifact.yamlFunc.Call([]reflect.Value{artifact.defaults}) + data := result[0].String() + if data == "" { + panic(fmt.Sprintf("failed to generate YAML for %q: %v", artifact.filename, result[1].String())) } _, err = f.WriteString(data) diff --git a/vendor/github.com/ceph/ceph-csi/api/deploy/kubernetes/rbd/csidriver.go b/vendor/github.com/ceph/ceph-csi/api/deploy/kubernetes/rbd/csidriver.go new file mode 100644 index 000000000..2708e98a3 --- /dev/null +++ b/vendor/github.com/ceph/ceph-csi/api/deploy/kubernetes/rbd/csidriver.go @@ -0,0 +1,74 @@ +/* +Copyright 2021 The Ceph-CSI Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package rbd + +import ( + "bytes" + _ "embed" + "fmt" + "text/template" + + "github.com/ghodss/yaml" + storagev1 "k8s.io/api/storage/v1" +) + +//go:embed csidriver.yaml +var csiDriver string + +type CSIDriverValues struct { + Name string +} + +var CSIDriverDefaults = CSIDriverValues{ + Name: "rbd.csi.ceph.com", +} + +// NewCSIDriver takes a driver name from the CSIDriverValues struct and relaces +// the value in the template. A CSIDriver object is returned which can be +// created in the Kubernetes cluster. +func NewCSIDriver(values CSIDriverValues) (*storagev1.CSIDriver, error) { + data, err := NewCSIDriverYAML(values) + if err != nil { + return nil, err + } + + driver := &storagev1.CSIDriver{} + err = yaml.Unmarshal([]byte(data), driver) + if err != nil { + return nil, fmt.Errorf("failed convert YAML to %T: %w", driver, err) + } + + return driver, nil +} + +// NewCSIDriverYAML takes a driver name from the CSIDriverValues struct and relaces +// the value in the template. A CSIDriver object in YAML is returned which can be +// created in the Kubernetes cluster. +func NewCSIDriverYAML(values CSIDriverValues) (string, error) { + var buf bytes.Buffer + + tmpl, err := template.New("CSIDriver").Parse(csiDriver) + if err != nil { + return "", fmt.Errorf("failed to parse template: %w", err) + } + err = tmpl.Execute(&buf, values) + if err != nil { + return "", fmt.Errorf("failed to replace values in template: %w", err) + } + + return buf.String(), nil +} diff --git a/vendor/github.com/ceph/ceph-csi/api/deploy/kubernetes/rbd/csidriver.yaml b/vendor/github.com/ceph/ceph-csi/api/deploy/kubernetes/rbd/csidriver.yaml new file mode 100644 index 000000000..4ab105dcc --- /dev/null +++ b/vendor/github.com/ceph/ceph-csi/api/deploy/kubernetes/rbd/csidriver.yaml @@ -0,0 +1,10 @@ +--- +# if Kubernetes version is less than 1.18 change +# apiVersion to storage.k8s.io/v1beta1 +apiVersion: storage.k8s.io/v1 +kind: CSIDriver +metadata: + name: "{{ .Name }}" +spec: + attachRequired: true + podInfoOnMount: false diff --git a/vendor/modules.txt b/vendor/modules.txt index 8b0257647..46b538f17 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -51,6 +51,7 @@ github.com/blang/semver github.com/cenkalti/backoff/v3 # github.com/ceph/ceph-csi/api v0.0.0-00010101000000-000000000000 => ./api ## explicit +github.com/ceph/ceph-csi/api/deploy/kubernetes/rbd github.com/ceph/ceph-csi/api/deploy/ocp # github.com/ceph/go-ceph v0.11.0 ## explicit From c443320126c7118f49b9b5c1a8dacef0fb058da4 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Wed, 6 Oct 2021 17:12:03 +0200 Subject: [PATCH 15/18] deploy: move rbd/ceph-csi-config ConfigMap to API Signed-off-by: Niels de Vos --- api/deploy/kubernetes/rbd/csi-config-map.go | 74 +++++++++++++++++++ api/deploy/kubernetes/rbd/csi-config-map.yaml | 8 ++ .../kubernetes/rbd/csi-config-map_test.go | 38 ++++++++++ deploy/Makefile | 6 +- deploy/rbd/kubernetes/csi-config-map.yaml | 12 ++- tools/yamlgen/main.go | 5 ++ .../deploy/kubernetes/rbd/csi-config-map.go | 74 +++++++++++++++++++ .../deploy/kubernetes/rbd/csi-config-map.yaml | 8 ++ 8 files changed, 222 insertions(+), 3 deletions(-) create mode 100644 api/deploy/kubernetes/rbd/csi-config-map.go create mode 100644 api/deploy/kubernetes/rbd/csi-config-map.yaml create mode 100644 api/deploy/kubernetes/rbd/csi-config-map_test.go create mode 100644 vendor/github.com/ceph/ceph-csi/api/deploy/kubernetes/rbd/csi-config-map.go create mode 100644 vendor/github.com/ceph/ceph-csi/api/deploy/kubernetes/rbd/csi-config-map.yaml diff --git a/api/deploy/kubernetes/rbd/csi-config-map.go b/api/deploy/kubernetes/rbd/csi-config-map.go new file mode 100644 index 000000000..13012ee4e --- /dev/null +++ b/api/deploy/kubernetes/rbd/csi-config-map.go @@ -0,0 +1,74 @@ +/* +Copyright 2021 The Ceph-CSI Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package rbd + +import ( + "bytes" + _ "embed" + "fmt" + "text/template" + + "github.com/ghodss/yaml" + v1 "k8s.io/api/core/v1" +) + +//go:embed csi-config-map.yaml +var csiConfigMap string + +type CSIConfigMapValues struct { + Name string +} + +var CSIConfigMapDefaults = CSIConfigMapValues{ + Name: "ceph-csi-config", +} + +// NewCSIConfigMap takes a name from the CSIConfigMapValues struct and relaces +// the value in the template. A ConfigMap object is returned which can be +// created in the Kubernetes cluster. +func NewCSIConfigMap(values CSIConfigMapValues) (*v1.ConfigMap, error) { + data, err := NewCSIConfigMapYAML(values) + if err != nil { + return nil, err + } + + cm := &v1.ConfigMap{} + err = yaml.Unmarshal([]byte(data), cm) + if err != nil { + return nil, fmt.Errorf("failed convert YAML to %T: %w", cm, err) + } + + return cm, nil +} + +// NewCSIConfigMapYAML takes a name from the CSIConfigMapValues struct and +// relaces the value in the template. A ConfigMap object in YAML is returned +// which can be created in the Kubernetes cluster. +func NewCSIConfigMapYAML(values CSIConfigMapValues) (string, error) { + var buf bytes.Buffer + + tmpl, err := template.New("CSIConfigMap").Parse(csiConfigMap) + if err != nil { + return "", fmt.Errorf("failed to parse template: %w", err) + } + err = tmpl.Execute(&buf, values) + if err != nil { + return "", fmt.Errorf("failed to replace values in template: %w", err) + } + + return buf.String(), nil +} diff --git a/api/deploy/kubernetes/rbd/csi-config-map.yaml b/api/deploy/kubernetes/rbd/csi-config-map.yaml new file mode 100644 index 000000000..c8a48eb4a --- /dev/null +++ b/api/deploy/kubernetes/rbd/csi-config-map.yaml @@ -0,0 +1,8 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: "{{ .Name }}" +data: + config.json: |- + [] diff --git a/api/deploy/kubernetes/rbd/csi-config-map_test.go b/api/deploy/kubernetes/rbd/csi-config-map_test.go new file mode 100644 index 000000000..1cc5cd67f --- /dev/null +++ b/api/deploy/kubernetes/rbd/csi-config-map_test.go @@ -0,0 +1,38 @@ +/* +Copyright 2021 The Ceph-CSI Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package rbd + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestNewCSIConfigMap(t *testing.T) { + cm, err := NewCSIConfigMap(CSIConfigMapDefaults) + + require.NoError(t, err) + require.NotNil(t, cm) + require.Equal(t, cm.Name, CSIConfigMapDefaults.Name) +} + +func TestNewCSIConfigMapYAML(t *testing.T) { + yaml, err := NewCSIConfigMapYAML(CSIConfigMapDefaults) + + require.NoError(t, err) + require.NotEqual(t, "", yaml) +} diff --git a/deploy/Makefile b/deploy/Makefile index d68bb8af5..9d6decc4c 100644 --- a/deploy/Makefile +++ b/deploy/Makefile @@ -15,10 +15,14 @@ .PHONY: all all: \ scc.yaml \ - rbd/kubernetes/csidriver.yaml + rbd/kubernetes/csidriver.yaml \ + rbd/kubernetes/csi-config-map.yaml scc.yaml: ../api/deploy/ocp/scc.yaml ../api/deploy/ocp/scc.go $(MAKE) -C ../tools generate-deploy rbd/kubernetes/csidriver.yaml: ../api/deploy/kubernetes/rbd/csidriver.yaml ../api/deploy/kubernetes/rbd/csidriver.go $(MAKE) -C ../tools generate-deploy + +rbd/kubernetes/csi-config-map.yaml: ../api/deploy/kubernetes/rbd/csidriver.* + $(MAKE) -C ../tools generate-deploy diff --git a/deploy/rbd/kubernetes/csi-config-map.yaml b/deploy/rbd/kubernetes/csi-config-map.yaml index 3efb0c1be..a358a16cc 100644 --- a/deploy/rbd/kubernetes/csi-config-map.yaml +++ b/deploy/rbd/kubernetes/csi-config-map.yaml @@ -1,8 +1,16 @@ --- +# +# /!\ DO NOT MODIFY THIS FILE +# +# This file has been automatically generated by Ceph-CSI yamlgen. +# The source for the contents can be found in the api/deploy directory, make +# your modifications there. +# +--- apiVersion: v1 kind: ConfigMap +metadata: + name: "ceph-csi-config" data: config.json: |- [] -metadata: - name: ceph-csi-config diff --git a/tools/yamlgen/main.go b/tools/yamlgen/main.go index 5bdfd5a4e..d90655919 100644 --- a/tools/yamlgen/main.go +++ b/tools/yamlgen/main.go @@ -52,6 +52,11 @@ var yamlArtifacts = []deploymentArtifact{ reflect.ValueOf(rbd.NewCSIDriverYAML), reflect.ValueOf(rbd.CSIDriverDefaults), }, + { + "../deploy/rbd/kubernetes/csi-config-map.yaml", + reflect.ValueOf(rbd.NewCSIConfigMapYAML), + reflect.ValueOf(rbd.CSIConfigMapDefaults), + }, } func main() { diff --git a/vendor/github.com/ceph/ceph-csi/api/deploy/kubernetes/rbd/csi-config-map.go b/vendor/github.com/ceph/ceph-csi/api/deploy/kubernetes/rbd/csi-config-map.go new file mode 100644 index 000000000..13012ee4e --- /dev/null +++ b/vendor/github.com/ceph/ceph-csi/api/deploy/kubernetes/rbd/csi-config-map.go @@ -0,0 +1,74 @@ +/* +Copyright 2021 The Ceph-CSI Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package rbd + +import ( + "bytes" + _ "embed" + "fmt" + "text/template" + + "github.com/ghodss/yaml" + v1 "k8s.io/api/core/v1" +) + +//go:embed csi-config-map.yaml +var csiConfigMap string + +type CSIConfigMapValues struct { + Name string +} + +var CSIConfigMapDefaults = CSIConfigMapValues{ + Name: "ceph-csi-config", +} + +// NewCSIConfigMap takes a name from the CSIConfigMapValues struct and relaces +// the value in the template. A ConfigMap object is returned which can be +// created in the Kubernetes cluster. +func NewCSIConfigMap(values CSIConfigMapValues) (*v1.ConfigMap, error) { + data, err := NewCSIConfigMapYAML(values) + if err != nil { + return nil, err + } + + cm := &v1.ConfigMap{} + err = yaml.Unmarshal([]byte(data), cm) + if err != nil { + return nil, fmt.Errorf("failed convert YAML to %T: %w", cm, err) + } + + return cm, nil +} + +// NewCSIConfigMapYAML takes a name from the CSIConfigMapValues struct and +// relaces the value in the template. A ConfigMap object in YAML is returned +// which can be created in the Kubernetes cluster. +func NewCSIConfigMapYAML(values CSIConfigMapValues) (string, error) { + var buf bytes.Buffer + + tmpl, err := template.New("CSIConfigMap").Parse(csiConfigMap) + if err != nil { + return "", fmt.Errorf("failed to parse template: %w", err) + } + err = tmpl.Execute(&buf, values) + if err != nil { + return "", fmt.Errorf("failed to replace values in template: %w", err) + } + + return buf.String(), nil +} diff --git a/vendor/github.com/ceph/ceph-csi/api/deploy/kubernetes/rbd/csi-config-map.yaml b/vendor/github.com/ceph/ceph-csi/api/deploy/kubernetes/rbd/csi-config-map.yaml new file mode 100644 index 000000000..c8a48eb4a --- /dev/null +++ b/vendor/github.com/ceph/ceph-csi/api/deploy/kubernetes/rbd/csi-config-map.yaml @@ -0,0 +1,8 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: "{{ .Name }}" +data: + config.json: |- + [] From cff0e04e3cefbe255a2ad1e92d1862206587cd3c Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Tue, 12 Oct 2021 13:36:41 +0200 Subject: [PATCH 16/18] build: remove unneeded empty YAML document from deployment artifacts The generated files under the deploy/ directory contain an empty YAML document that may cause confusion for some versions of kubectl. Dropping the unneeded `---` start of the file for the header should make parsing of the deployment artifacts a little less error prone. Signed-off-by: Niels de Vos --- deploy/rbd/kubernetes/csi-config-map.yaml | 1 - deploy/rbd/kubernetes/csidriver.yaml | 1 - deploy/scc.yaml | 1 - tools/yamlgen/main.go | 3 +-- 4 files changed, 1 insertion(+), 5 deletions(-) diff --git a/deploy/rbd/kubernetes/csi-config-map.yaml b/deploy/rbd/kubernetes/csi-config-map.yaml index a358a16cc..44ef712a4 100644 --- a/deploy/rbd/kubernetes/csi-config-map.yaml +++ b/deploy/rbd/kubernetes/csi-config-map.yaml @@ -1,4 +1,3 @@ ---- # # /!\ DO NOT MODIFY THIS FILE # diff --git a/deploy/rbd/kubernetes/csidriver.yaml b/deploy/rbd/kubernetes/csidriver.yaml index ef0eb1390..1ece4e96e 100644 --- a/deploy/rbd/kubernetes/csidriver.yaml +++ b/deploy/rbd/kubernetes/csidriver.yaml @@ -1,4 +1,3 @@ ---- # # /!\ DO NOT MODIFY THIS FILE # diff --git a/deploy/scc.yaml b/deploy/scc.yaml index 37730959a..36c1973a7 100644 --- a/deploy/scc.yaml +++ b/deploy/scc.yaml @@ -1,4 +1,3 @@ ---- # # /!\ DO NOT MODIFY THIS FILE # diff --git a/tools/yamlgen/main.go b/tools/yamlgen/main.go index d90655919..eb255c2f6 100644 --- a/tools/yamlgen/main.go +++ b/tools/yamlgen/main.go @@ -25,8 +25,7 @@ import ( "github.com/ceph/ceph-csi/api/deploy/ocp" ) -const header = `--- -# +const header = `# # /!\ DO NOT MODIFY THIS FILE # # This file has been automatically generated by Ceph-CSI yamlgen. From 7c4b29bd579372d3d9772c4d4c0389bf70496431 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Oct 2021 08:59:19 +0000 Subject: [PATCH 17/18] rebase: bump sigs.k8s.io/controller-runtime from 0.10.1 to 0.10.2 Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.10.1 to 0.10.2. - [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases) - [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.10.1...v0.10.2) --- updated-dependencies: - dependency-name: sigs.k8s.io/controller-runtime dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +- vendor/modules.txt | 2 +- .../controller-runtime/pkg/source/source.go | 33 ++++-- .../pkg/webhook/admission/defaulter_custom.go | 85 ++++++++++++++ .../pkg/webhook/admission/validator_custom.go | 111 ++++++++++++++++++ .../controller-runtime/pkg/webhook/alias.go | 6 + 7 files changed, 232 insertions(+), 11 deletions(-) create mode 100644 vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/defaulter_custom.go create mode 100644 vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/validator_custom.go diff --git a/go.mod b/go.mod index 4f15fb382..ced5cb1ae 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( k8s.io/kubernetes v1.22.2 k8s.io/mount-utils v0.22.2 k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a - sigs.k8s.io/controller-runtime v0.10.1 + sigs.k8s.io/controller-runtime v0.10.2 ) replace ( diff --git a/go.sum b/go.sum index 25065714c..8fa2daccf 100644 --- a/go.sum +++ b/go.sum @@ -1620,8 +1620,8 @@ rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22 h1:fmRfl9WJ4ApJn7LxNuED4m0t18qivVQOxP6aAYG9J6c= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= sigs.k8s.io/controller-runtime v0.2.2/go.mod h1:9dyohw3ZtoXQuV1e766PHUn+cmrRCIcBh6XIMFNMZ+I= -sigs.k8s.io/controller-runtime v0.10.1 h1:+eLHgY/VrJWnfg6iXUqhCUqNXgPH1NZeP9drNAAgWlg= -sigs.k8s.io/controller-runtime v0.10.1/go.mod h1:CQp8eyUQZ/Q7PJvnIrB6/hgfTC1kBkGylwsLgOQi1WY= +sigs.k8s.io/controller-runtime v0.10.2 h1:jW8qiY+yMnnPx6O9hu63tgcwaKzd1yLYui+mpvClOOc= +sigs.k8s.io/controller-runtime v0.10.2/go.mod h1:CQp8eyUQZ/Q7PJvnIrB6/hgfTC1kBkGylwsLgOQi1WY= sigs.k8s.io/kustomize/api v0.8.11/go.mod h1:a77Ls36JdfCWojpUqR6m60pdGY1AYFix4AH83nJtY1g= sigs.k8s.io/kustomize/cmd/config v0.9.13/go.mod h1:7547FLF8W/lTaDf0BDqFTbZxM9zqwEJqCKN9sSR0xSs= sigs.k8s.io/kustomize/kustomize/v4 v4.2.0/go.mod h1:MOkR6fmhwG7hEDRXBYELTi5GSFcLwfqwzTRHW3kv5go= diff --git a/vendor/modules.txt b/vendor/modules.txt index 46b538f17..aaee26e9c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1021,7 +1021,7 @@ k8s.io/utils/trace # sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22 sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client -# sigs.k8s.io/controller-runtime v0.10.1 +# sigs.k8s.io/controller-runtime v0.10.2 ## explicit sigs.k8s.io/controller-runtime/pkg/cache sigs.k8s.io/controller-runtime/pkg/cache/internal diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/source/source.go b/vendor/sigs.k8s.io/controller-runtime/pkg/source/source.go index a63b37c44..708c5a5bf 100644 --- a/vendor/sigs.k8s.io/controller-runtime/pkg/source/source.go +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/source/source.go @@ -21,8 +21,10 @@ import ( "errors" "fmt" "sync" + "time" "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/util/workqueue" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/event" @@ -119,17 +121,34 @@ func (ks *Kind) Start(ctx context.Context, handler handler.EventHandler, queue w ctx, ks.startCancel = context.WithCancel(ctx) ks.started = make(chan error) go func() { - // Lookup the Informer from the Cache and add an EventHandler which populates the Queue - i, err := ks.cache.GetInformer(ctx, ks.Type) - if err != nil { - kindMatchErr := &meta.NoKindMatchError{} - if errors.As(err, &kindMatchErr) { - log.Error(err, "if kind is a CRD, it should be installed before calling Start", - "kind", kindMatchErr.GroupKind) + var ( + i cache.Informer + lastErr error + ) + + // Tries to get an informer until it returns true, + // an error or the specified context is cancelled or expired. + if err := wait.PollImmediateUntilWithContext(ctx, 10*time.Second, func(ctx context.Context) (bool, error) { + // Lookup the Informer from the Cache and add an EventHandler which populates the Queue + i, lastErr = ks.cache.GetInformer(ctx, ks.Type) + if lastErr != nil { + kindMatchErr := &meta.NoKindMatchError{} + if errors.As(lastErr, &kindMatchErr) { + log.Error(lastErr, "if kind is a CRD, it should be installed before calling Start", + "kind", kindMatchErr.GroupKind) + } + return false, nil // Retry. + } + return true, nil + }); err != nil { + if lastErr != nil { + ks.started <- fmt.Errorf("failed to get informer from cache: %w", lastErr) + return } ks.started <- err return } + i.AddEventHandler(internal.EventHandler{Queue: queue, EventHandler: handler, Predicates: prct}) if !ks.cache.WaitForCacheSync(ctx) { // Would be great to return something more informative here diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/defaulter_custom.go b/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/defaulter_custom.go new file mode 100644 index 000000000..a012784e4 --- /dev/null +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/defaulter_custom.go @@ -0,0 +1,85 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package admission + +import ( + "context" + "encoding/json" + + "errors" + "net/http" + + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/runtime" +) + +// CustomDefaulter defines functions for setting defaults on resources. +type CustomDefaulter interface { + Default(ctx context.Context, obj runtime.Object) error +} + +// WithCustomDefaulter creates a new Webhook for a CustomDefaulter interface. +func WithCustomDefaulter(obj runtime.Object, defaulter CustomDefaulter) *Webhook { + return &Webhook{ + Handler: &defaulterForType{object: obj, defaulter: defaulter}, + } +} + +type defaulterForType struct { + defaulter CustomDefaulter + object runtime.Object + decoder *Decoder +} + +var _ DecoderInjector = &defaulterForType{} + +func (h *defaulterForType) InjectDecoder(d *Decoder) error { + h.decoder = d + return nil +} + +// Handle handles admission requests. +func (h *defaulterForType) Handle(ctx context.Context, req Request) Response { + if h.defaulter == nil { + panic("defaulter should never be nil") + } + if h.object == nil { + panic("object should never be nil") + } + + // Get the object in the request + obj := h.object.DeepCopyObject() + if err := h.decoder.Decode(req, obj); err != nil { + return Errored(http.StatusBadRequest, err) + } + + // Default the object + if err := h.defaulter.Default(ctx, obj); err != nil { + var apiStatus apierrors.APIStatus + if errors.As(err, &apiStatus) { + return validationResponseFromStatus(false, apiStatus.Status()) + } + return Denied(err.Error()) + } + + // Create the patch + marshalled, err := json.Marshal(obj) + if err != nil { + return Errored(http.StatusInternalServerError, err) + } + return PatchResponseFromRaw(req.Object.Raw, marshalled) +} diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/validator_custom.go b/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/validator_custom.go new file mode 100644 index 000000000..38d556511 --- /dev/null +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/validator_custom.go @@ -0,0 +1,111 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package admission + +import ( + "context" + "errors" + "fmt" + "net/http" + + v1 "k8s.io/api/admission/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/runtime" +) + +// CustomValidator defines functions for validating an operation. +type CustomValidator interface { + ValidateCreate(ctx context.Context, obj runtime.Object) error + ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) error + ValidateDelete(ctx context.Context, obj runtime.Object) error +} + +// WithCustomValidator creates a new Webhook for validating the provided type. +func WithCustomValidator(obj runtime.Object, validator CustomValidator) *Webhook { + return &Webhook{ + Handler: &validatorForType{object: obj, validator: validator}, + } +} + +type validatorForType struct { + validator CustomValidator + object runtime.Object + decoder *Decoder +} + +var _ DecoderInjector = &validatorForType{} + +// InjectDecoder injects the decoder into a validatingHandler. +func (h *validatorForType) InjectDecoder(d *Decoder) error { + h.decoder = d + return nil +} + +// Handle handles admission requests. +func (h *validatorForType) Handle(ctx context.Context, req Request) Response { + if h.validator == nil { + panic("validator should never be nil") + } + if h.object == nil { + panic("object should never be nil") + } + + // Get the object in the request + obj := h.object.DeepCopyObject() + + var err error + switch req.Operation { + case v1.Create: + if err := h.decoder.Decode(req, obj); err != nil { + return Errored(http.StatusBadRequest, err) + } + + err = h.validator.ValidateCreate(ctx, obj) + case v1.Update: + oldObj := obj.DeepCopyObject() + if err := h.decoder.DecodeRaw(req.Object, obj); err != nil { + return Errored(http.StatusBadRequest, err) + } + if err := h.decoder.DecodeRaw(req.OldObject, oldObj); err != nil { + return Errored(http.StatusBadRequest, err) + } + + err = h.validator.ValidateUpdate(ctx, oldObj, obj) + case v1.Delete: + // In reference to PR: https://github.com/kubernetes/kubernetes/pull/76346 + // OldObject contains the object being deleted + if err := h.decoder.DecodeRaw(req.OldObject, obj); err != nil { + return Errored(http.StatusBadRequest, err) + } + + err = h.validator.ValidateDelete(ctx, obj) + default: + return Errored(http.StatusBadRequest, fmt.Errorf("unknown operation request %q", req.Operation)) + } + + // Check the error message first. + if err != nil { + var apiStatus apierrors.APIStatus + if errors.As(err, &apiStatus) { + return validationResponseFromStatus(false, apiStatus.Status()) + } + return Denied(err.Error()) + } + + // Return allowed if everything succeeded. + return Allowed("") +} diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/alias.go b/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/alias.go index 1a831016a..293137db4 100644 --- a/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/alias.go +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/alias.go @@ -29,6 +29,12 @@ type Defaulter = admission.Defaulter // Validator defines functions for validating an operation. type Validator = admission.Validator +// CustomDefaulter defines functions for setting defaults on resources. +type CustomDefaulter = admission.CustomDefaulter + +// CustomValidator defines functions for validating an operation. +type CustomValidator = admission.CustomValidator + // AdmissionRequest defines the input for an admission handler. // It contains information to identify the object in // question (group, version, kind, resource, subresource, From 0d51f6d833f749214377c8c9616cd68760c7de58 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Thu, 14 Oct 2021 17:04:18 +0530 Subject: [PATCH 18/18] rbd: check local image description for split-brain In some corner case like `re-player shutdown` the local image will not be in error state. It would be also worth considering `description` field to make sure about split-brain. Signed-off-by: Madhu Rajanna --- internal/rbd/replicationcontrollerserver.go | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/internal/rbd/replicationcontrollerserver.go b/internal/rbd/replicationcontrollerserver.go index 95cfb30ba..26bee0a8a 100644 --- a/internal/rbd/replicationcontrollerserver.go +++ b/internal/rbd/replicationcontrollerserver.go @@ -634,8 +634,7 @@ func (rs *ReplicationServer) ResyncVolume(ctx context.Context, ready = checkRemoteSiteStatus(ctx, mirrorStatus) } - // resync only if the image is in error state - if strings.Contains(localStatus.State.String(), string(errorState)) { + if resyncRequired(localStatus) { err = rbdVol.resyncImage() if err != nil { log.ErrorLog(ctx, err.Error()) @@ -664,3 +663,20 @@ func (rs *ReplicationServer) ResyncVolume(ctx context.Context, return resp, nil } + +// resyncRequired returns true if local image is in split-brain state and image +// needs resync. +func resyncRequired(localStatus librbd.SiteMirrorImageStatus) bool { + // resync is required if the image is in error state or the description + // contains split-brain message. + // In some corner cases like `re-player shutdown` the local image will not + // be in an error state. It would be also worth considering the `description` + // field to make sure about split-brain. + splitBrain := "split-brain" + if strings.Contains(localStatus.State.String(), string(errorState)) || + strings.Contains(localStatus.Description, splitBrain) { + return true + } + + return false +}