Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F/ add ability to specify a privatelink end point for S3 file gateway - NFS resource #24038

Merged
merged 31 commits into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
598099a
support for maintenance start time (15331)
Sep 25, 2020
c24907e
fix for support for maintenance start time (15331)
Mar 26, 2021
48a4a55
Update nfs_file_share.go
kliu47 Apr 5, 2022
55040ce
Update nfs_file_share.go
kliu47 Apr 5, 2022
ef69a7e
Create 24038.txt
kliu47 Apr 5, 2022
a5a7212
Update storagegateway_nfs_file_share.html.markdown
kliu47 Apr 5, 2022
b59c3fc
Update 24038.txt
ewbankkit Apr 6, 2022
71aae45
Update storagegateway_nfs_file_share.html.markdown
ewbankkit Apr 6, 2022
5a9cd10
Revert "fix for support for maintenance start time (15331)"
ewbankkit Apr 6, 2022
c465474
Revert "support for maintenance start time (15331)"
ewbankkit Apr 6, 2022
51bfba4
Merge commit 'c465474c0fcddcd2a32dbc83bd0a5c259ccd4dd2' into HEAD
ewbankkit Apr 6, 2022
853affe
r/aws_storagegateway_nfs_file_share: Alphabetize attributes.
ewbankkit Apr 6, 2022
3e2b2d9
r/aws_storagegateway_nfs_file_share: Add and use '_Values()' (#14601).
ewbankkit Apr 6, 2022
ff4ff5c
r/aws_storagegateway_nfs_file_share: Cosmetics.
ewbankkit Apr 6, 2022
2301d98
Add and use 'FindNFSFileShareByARN'.
ewbankkit Apr 6, 2022
5bc9eaf
'statussmBFileShare' -> 'statusSMBFileShare'.
ewbankkit Apr 6, 2022
4438ce1
r/aws_storagegateway_nfs_file_share: Test 'bucket_region' and 'vpc_en…
ewbankkit Apr 6, 2022
59f9092
r/aws_storagegateway_gateway: Alphabetize attributes.
ewbankkit Apr 6, 2022
9af967f
r/aws_storagegateway_gateway: Add and use '_Values()' (#14601).
ewbankkit Apr 6, 2022
a9be9aa
r/aws_storagegateway_gateway: Tidy up resource Delete.
ewbankkit Apr 6, 2022
2dee622
Fix gofmt error
Apr 6, 2022
e3f1e17
r/aws_storagegateway_gateway: Tidy up resource Update.
ewbankkit Apr 6, 2022
52f5de9
r/aws_storagegateway_gateway: Minor tidy up of resource Create.
ewbankkit Apr 6, 2022
de6992e
r/aws_storagegateway_gateway: Add and use 'FindGatewayByARN'.
ewbankkit Apr 6, 2022
92f19d8
r/aws_storagegateway_gateway: Add 'maintenance_start_time' argument.
ewbankkit Apr 6, 2022
c9963d9
Add 'TestAccStorageGatewayGateway_maintenanceStartTime'.
ewbankkit Apr 6, 2022
6c2e7db
Revert "Fix gofmt error"
ewbankkit Apr 6, 2022
f2b5d02
Merge commit 'c9963d908aeb87b0f86eab5f89700252df75e7cb' into HEAD
ewbankkit Apr 6, 2022
748ac26
Pass 'null' for missing 'day_of_week' or 'day_of_month' values.
ewbankkit Apr 6, 2022
ac56cd8
Fix golangci-lint errors.
ewbankkit Apr 7, 2022
0621666
r/aws_storagegateway_gateway: Make 'maintenance_start_time.day_of_mon…
ewbankkit Apr 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/15355.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_storagegateway_gateway: Add `maintenance_start_time` argument
```
3 changes: 3 additions & 0 deletions .changelog/24038.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_storagegateway_nfs_file_share: Add `bucket_region` and `vpc_endpoint_dns_name` arguments to support PrivateLink endpoints
```
64 changes: 64 additions & 0 deletions internal/service/storagegateway/enum.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ func authentication_Values() []string {
}
}

const (
bandwidthTypeAll = "ALL"
bandwidthTypeDownload = "DOWNLOAD"
bandwidthTypeUpload = "UPLOAD"
)

const (
defaultStorageClassS3IntelligentTiering = "S3_INTELLIGENT_TIERING"
defaultStorageClassS3OneZoneIA = "S3_ONEZONE_IA"
Expand All @@ -30,6 +36,64 @@ func defaultStorageClass_Values() []string {
}
}

const (
gatewayTypeCached = "CACHED"
gatewayTypeFileFSXSMB = "FILE_FSX_SMB"
gatewayTypeFileS3 = "FILE_S3"
gatewayTypeStored = "STORED"
gatewayTypeVTL = "VTL"
gatewayTypeVTLSnow = "VTL_SNOW"
)

func gatewayType_Values() []string {
return []string{
gatewayTypeCached,
gatewayTypeFileFSXSMB,
gatewayTypeFileS3,
gatewayTypeStored,
gatewayTypeVTL,
gatewayTypeVTLSnow,
}
}

const (
mediumChangerTypeAWS_Gateway_VTL = "AWS-Gateway-VTL"
mediumChangerTypeIBM_03584L32_0402 = "IBM-03584L32-0402"
mediumChangerTypeSTK_L700 = "STK-L700"
)

func mediumChangerType_Values() []string {
return []string{
mediumChangerTypeAWS_Gateway_VTL,
mediumChangerTypeIBM_03584L32_0402,
mediumChangerTypeSTK_L700,
}
}

const (
squashAllSquash = "AllSquash"
squashNoSquash = "NoSquash"
squashRootSquash = "RootSquash"
)

func squash_Values() []string {
return []string{
squashAllSquash,
squashNoSquash,
squashRootSquash,
}
}

const (
tapeDriveTypeIBM_ULT3580_TD5 = "IBM-ULT3580-TD5"
)

func tapeDriveType_Values() []string {
return []string{
tapeDriveTypeIBM_ULT3580_TD5,
}
}

const (
fileShareStatusAvailable = "AVAILABLE"
fileShareStatusCreating = "CREATING"
Expand Down
5 changes: 3 additions & 2 deletions internal/service/storagegateway/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
"github.com/aws/aws-sdk-go/service/storagegateway"
)

// Error code constants missing from AWS Go SDK:
// https://docs.aws.amazon.com/sdk-for-go/api/service/storagegateway/#pkg-constants
// Operation error code constants missing from AWS Go SDK: https://docs.aws.amazon.com/sdk-for-go/api/service/storagegateway/#pkg-constants.
// See https://docs.aws.amazon.com/storagegateway/latest/userguide/AWSStorageGatewayAPI.html#APIOperationErrorCodes for details.
const (
operationErrCodeFileShareNotFound = "FileShareNotFound"
operationErrCodeFileSystemAssociationNotFound = "FileSystemAssociationNotFound"
operationErrCodeGatewayNotFound = "GatewayNotFound"
)

// operationErrorCode returns the operation error code from the specified error:
Expand Down
55 changes: 55 additions & 0 deletions internal/service/storagegateway/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package storagegateway
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/storagegateway"
"github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-provider-aws/internal/tfresource"
)
Expand Down Expand Up @@ -82,6 +83,60 @@ func FindUploadBufferDisk(conn *storagegateway.StorageGateway, gatewayARN string
return result, err
}

func FindGatewayByARN(conn *storagegateway.StorageGateway, arn string) (*storagegateway.DescribeGatewayInformationOutput, error) {
input := &storagegateway.DescribeGatewayInformationInput{
GatewayARN: aws.String(arn),
}

output, err := conn.DescribeGatewayInformation(input)

if operationErrorCode(err) == operationErrCodeGatewayNotFound || tfawserr.ErrCodeEquals(err, storagegateway.ErrorCodeGatewayNotFound) {
return nil, &resource.NotFoundError{
LastError: err,
LastRequest: input,
}
}

if err != nil {
return nil, err
}

if output == nil {
return nil, tfresource.NewEmptyResultError(input)
}

return output, nil
}

func FindNFSFileShareByARN(conn *storagegateway.StorageGateway, arn string) (*storagegateway.NFSFileShareInfo, error) {
input := &storagegateway.DescribeNFSFileSharesInput{
FileShareARNList: aws.StringSlice([]string{arn}),
}

output, err := conn.DescribeNFSFileShares(input)

if operationErrorCode(err) == operationErrCodeFileShareNotFound {
return nil, &resource.NotFoundError{
LastError: err,
LastRequest: input,
}
}

if err != nil {
return nil, err
}

if output == nil || len(output.NFSFileShareInfoList) == 0 || output.NFSFileShareInfoList[0] == nil {
return nil, tfresource.NewEmptyResultError(input)
}

if count := len(output.NFSFileShareInfoList); count > 1 {
return nil, tfresource.NewTooManyResultsError(count, input)
}

return output.NFSFileShareInfoList[0], nil
}

func FindSMBFileShareByARN(conn *storagegateway.StorageGateway, arn string) (*storagegateway.SMBFileShareInfo, error) {
input := &storagegateway.DescribeSMBFileSharesInput{
FileShareARNList: aws.StringSlice([]string{arn}),
Expand Down
Loading