Skip to content

Commit a8360ca

Browse files
authored
Merge branch 'main' into james/oss-3296-interface-to-any
2 parents 3308b35 + 136ae84 commit a8360ca

21 files changed

Lines changed: 477 additions & 18 deletions

File tree

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,23 @@ variety of helper functions and patterns for common infrastructure testing tasks
2222
- Running shell commands
2323
- And much more
2424

25-
Please see the following for more info:
25+
## Install
26+
27+
```bash
28+
go get github.com/gruntwork-io/terratest@latest
29+
```
30+
31+
Requires Go 1.26 or later.
32+
33+
## Stability and versioning
34+
35+
Starting with v1.0.0, Terratest follows [semantic versioning](https://semver.org/). Breaking changes to the public API
36+
only happen in major releases (e.g. v2.0.0).
37+
38+
Symbols renamed or replaced in v1 are kept with `// Deprecated:` annotations pointing at the new name; removals happen
39+
in v2. Migrating from v0.x: see [`MIGRATION.md`](./MIGRATION.md).
40+
41+
## More info
2642

2743
- [Terratest Website](https://terratest.gruntwork.io)
2844
- [Getting started with Terratest](https://terratest.gruntwork.io/docs/getting-started/quick-start/)
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
---
2+
layout: collection-browser-doc
3+
title: Azure modules
4+
category: migrating-to-v1
5+
excerpt: >-
6+
Migrate Azure tests from Terratest pre-v1 to v1.0.0.
7+
tags: ["azure", "migration", "v1"]
8+
order: 300
9+
nav_title: Documentation
10+
nav_title_link: /docs/
11+
---
12+
13+
The `modules/azure` package received the largest set of breaking changes in
14+
the v1.0.0 release. This guide walks through what changed and how to update
15+
your tests.
16+
17+
## Why we migrated
18+
19+
The previous version of `modules/azure` was built on
20+
`github.com/Azure/azure-sdk-for-go/services/...`, the legacy "track 1" Azure
21+
SDK. Microsoft has archived that SDK; it no longer receives feature updates,
22+
bug fixes, or security patches.
23+
24+
v1.0.0 moves the entire package to
25+
`github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/...`, the modular,
26+
actively maintained "track 2" SDK. The new SDK has a different shape: typed
27+
resource clients are produced by a `ClientFactory`, response payloads put
28+
most fields on a nested `Properties` struct, and pagination uses pagers
29+
instead of iterators. We took the opportunity to land a few small API
30+
cleanups at the same time so v1.0.0 ships a coherent, stable surface.
31+
32+
## What changed at a glance
33+
34+
- All Azure service code now imports `sdk/resourcemanager/<service>/arm<service>` packages instead of `services/<service>/mgmt/<api-version>/<service>`.
35+
- Resource fields moved under `.Properties` (e.g. `vm.StorageProfile` is now `vm.Properties.StorageProfile`).
36+
- Iterator-based list calls (`NextWithContext`) are replaced with pagers (`NewListPager` / `More` / `NextPage`).
37+
- 8 deprecated `Get*ClientE` client-getter functions were removed; the `Create*ClientE` replacements have been around for a while.
38+
- 4 `CreateNew*ClientContextE` factories were renamed to `Create*ClientContextE`. The old names remain as deprecated aliases.
39+
- `NsgRuleSummary.SourceAdresssPrefixes` (triple-s typo) was renamed to `SourceAddressPrefixes`.
40+
- A new `*WithClient` family of functions was added so tests can inject a fake or pre-built SDK client (useful with the Azure SDK's `azfake` package).
41+
- `GetVirtualMachineImage` / `GetVirtualMachineImageE` now return `*VMImage` instead of `VMImage`.
42+
43+
## Updating SDK imports
44+
45+
Most Terratest users do not import the underlying Azure SDK directly,
46+
because Terratest wraps it. If you only call `terratest/modules/azure`
47+
helpers, you can usually skip this section. If your tests do import the SDK
48+
(for example to construct request objects or assert on returned types),
49+
update imports as follows:
50+
51+
| Old (`services/...`) | New (`sdk/resourcemanager/...`) |
52+
| --- | --- |
53+
| `github.com/Azure/azure-sdk-for-go/services/compute/mgmt/.../compute` | `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6` |
54+
| `github.com/Azure/azure-sdk-for-go/services/network/mgmt/.../network` | `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6` |
55+
| `github.com/Azure/azure-sdk-for-go/services/storage/mgmt/.../storage` | `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage` |
56+
| `github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/.../documentdb` | `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3` |
57+
| `github.com/Azure/azure-sdk-for-go/services/servicebus/mgmt/.../servicebus` | `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicebus/armservicebus/v2` |
58+
| `github.com/Azure/azure-sdk-for-go/services/preview/containerservice/.../containerservice` | `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6` |
59+
| `github.com/Azure/azure-sdk-for-go/services/containerregistry/mgmt/.../containerregistry` | `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry` |
60+
| `github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/.../containerinstance` | `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance/v2` |
61+
| `github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/.../operationalinsights` | `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/operationalinsights/armoperationalinsights/v2` |
62+
| `github.com/Azure/azure-sdk-for-go/services/resources/mgmt/.../subscriptions` | `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions` |
63+
| `github.com/Azure/azure-sdk-for-go/services/resources/mgmt/.../resources` | `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources` |
64+
| `github.com/Azure/azure-sdk-for-go/services/privatedns/mgmt/.../privatedns` | `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns` |
65+
| `github.com/Azure/azure-sdk-for-go/profiles/latest/frontdoor/mgmt/frontdoor` | `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/frontdoor/armfrontdoor` |
66+
| `github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights` | `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor` |
67+
| `github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/.../recoveryservices` | `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservices` |
68+
| `github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/.../backup` | `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4` |
69+
70+
Once imports are updated, expect three follow-on edits per file:
71+
72+
1. **Type names** lose their old prefix and gain `arm`. For example
73+
`compute.VirtualMachine` becomes `armcompute.VirtualMachine`,
74+
`network.SecurityGroup` becomes `armnetwork.SecurityGroup`, and
75+
`storage.Account` becomes `armstorage.Account`.
76+
2. **Field access** moves under `.Properties`. For example
77+
`vm.StorageProfile` becomes `vm.Properties.StorageProfile`, and
78+
`registry.LoginServer` becomes `registry.Properties.LoginServer`.
79+
3. **List iteration** moves to the pager pattern: replace
80+
`iterator.NextWithContext(ctx)` loops with
81+
`for pager.More() { page, err := pager.NextPage(ctx); ... }`.
82+
83+
## Renamed factory functions
84+
85+
Four client factories were renamed to drop the redundant `New` (a
86+
`Create*New*Client` reads as redundant). The old names remain as deprecated
87+
aliases for one minor release; please update at your convenience.
88+
89+
| Old name | New name |
90+
| --- | --- |
91+
| `CreateNewNetworkInterfacesClientE` | `CreateNetworkInterfacesClientE` |
92+
| `CreateNewNetworkInterfacesClientContextE` | `CreateNetworkInterfacesClientContextE` |
93+
| `CreateNewNetworkInterfaceIPConfigurationClientE` | `CreateNetworkInterfaceIPConfigurationClientE` |
94+
| `CreateNewNetworkInterfaceIPConfigurationClientContextE` | `CreateNetworkInterfaceIPConfigurationClientContextE` |
95+
| `CreateNewSubnetClientE` | `CreateSubnetClientE` |
96+
| `CreateNewSubnetClientContextE` | `CreateSubnetClientContextE` |
97+
| `CreateNewVirtualNetworkClientE` | `CreateVirtualNetworkClientE` |
98+
| `CreateNewVirtualNetworkClientContextE` | `CreateVirtualNetworkClientContextE` |
99+
100+
## Removed deprecated functions
101+
102+
The previous release marked eight client-getter functions for removal
103+
("`TODO: remove in next version`"). v1.0.0 is that version. Each removed
104+
function has a long-standing `Create*ClientE` replacement.
105+
106+
| Removed | Replacement |
107+
| --- | --- |
108+
| `GetAvailabilitySetClientE` | `CreateAvailabilitySetClientE` |
109+
| `GetDiskClientE` | `CreateDisksClientE` |
110+
| `GetDiagnosticsSettingsClientE` | `CreateDiagnosticsSettingsClientE` |
111+
| `GetVMInsightsClientE` | `CreateVMInsightsClientE` |
112+
| `GetActivityLogAlertsClientE` | `CreateActivityLogAlertsClientE` |
113+
| `GetResourceGroupClientE` | `CreateResourceGroupClientE` |
114+
| `GetStorageAccountClientE` | `CreateStorageAccountClientE` |
115+
| `GetStorageBlobContainerClientE` | `CreateStorageBlobContainerClientE` |
116+
117+
The replacements take the same arguments and return the same client type
118+
(now from the new SDK). The rename is mechanical: `Get``Create`. Note
119+
that `GetDiskClientE` becomes `CreateDisksClientE` (plural) to match the
120+
underlying SDK's `DisksClient` type.
121+
122+
## Typo fix on `NsgRuleSummary`
123+
124+
`NsgRuleSummary.SourceAdresssPrefixes` (note the three s's) was renamed to
125+
the correctly-spelled `SourceAddressPrefixes`. The field type
126+
(`[]string`) is unchanged. Update any code that read or set this field:
127+
128+
```go
129+
// Before
130+
for _, prefix := range rule.SourceAdresssPrefixes {
131+
// ...
132+
}
133+
134+
// After
135+
for _, prefix := range rule.SourceAddressPrefixes {
136+
// ...
137+
}
138+
```
139+
140+
The paired `DestinationAddressPrefixes` field was already spelled
141+
correctly and is unchanged.
142+
143+
## `VMImage` is now a pointer
144+
145+
`GetVirtualMachineImage` and `GetVirtualMachineImageE` now return
146+
`*VMImage` instead of `VMImage`, matching every other resource getter in
147+
the package.
148+
149+
```go
150+
// Before
151+
img := azure.GetVirtualMachineImage(t, vmName, rg, sub)
152+
fmt.Println(img.Publisher)
153+
154+
// After
155+
img := azure.GetVirtualMachineImage(t, vmName, rg, sub)
156+
if img != nil {
157+
fmt.Println(img.Publisher)
158+
}
159+
```
160+
161+
If the resource cannot be loaded the function still fails the test, so
162+
the `nil` guard is precautionary.
163+
164+
## New `WithClient` variants for testability
165+
166+
v1.0.0 adds a parallel family of `*WithClient` functions across all Azure
167+
modules. Each one accepts a pre-built SDK client and a
168+
`context.Context`, so you can drive Terratest helpers against the Azure
169+
SDK's `azfake` fake-server framework in unit tests:
170+
171+
```go
172+
import (
173+
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6"
174+
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6/fake"
175+
)
176+
177+
// Build a fake client that returns a canned response.
178+
fakeServer := fake.DisksServer{ /* ... */ }
179+
client, _ := armcompute.NewDisksClient("sub-id", nil, &arm.ClientOptions{
180+
ClientOptions: azcore.ClientOptions{
181+
Transport: fake.NewDisksServerTransport(&fakeServer),
182+
},
183+
})
184+
185+
disk, err := azure.GetDiskWithClient(ctx, client, resourceGroup, diskName)
186+
```
187+
188+
This is purely additive: the existing `*ContextE` functions still work and
189+
build their own clients from ambient credentials. Use `WithClient`
190+
variants only if you need test injection.
191+
192+
## Search-and-replace cheatsheet
193+
194+
Most projects can do the bulk of the migration with a few find/replace
195+
passes. The snippets below cover the most common edits:
196+
197+
```bash
198+
# Removed Get*ClientE functions -> Create*ClientE
199+
sd 'GetAvailabilitySetClientE\b' 'CreateAvailabilitySetClientE' $(rg -l 'GetAvailabilitySetClientE')
200+
sd 'GetDiskClientE\b' 'CreateDisksClientE' $(rg -l 'GetDiskClientE')
201+
sd 'GetDiagnosticsSettingsClientE\b' 'CreateDiagnosticsSettingsClientE' $(rg -l 'GetDiagnosticsSettingsClientE')
202+
sd 'GetVMInsightsClientE\b' 'CreateVMInsightsClientE' $(rg -l 'GetVMInsightsClientE')
203+
sd 'GetActivityLogAlertsClientE\b' 'CreateActivityLogAlertsClientE' $(rg -l 'GetActivityLogAlertsClientE')
204+
sd 'GetResourceGroupClientE\b' 'CreateResourceGroupClientE' $(rg -l 'GetResourceGroupClientE')
205+
sd 'GetStorageAccountClientE\b' 'CreateStorageAccountClientE' $(rg -l 'GetStorageAccountClientE')
206+
sd 'GetStorageBlobContainerClientE\b' 'CreateStorageBlobContainerClientE' $(rg -l 'GetStorageBlobContainerClientE')
207+
208+
# CreateNew*Client renames
209+
sd 'CreateNewNetworkInterfacesClient' 'CreateNetworkInterfacesClient' $(rg -l 'CreateNewNetworkInterfacesClient')
210+
sd 'CreateNewNetworkInterfaceIPConfigurationClient' 'CreateNetworkInterfaceIPConfigurationClient' $(rg -l 'CreateNewNetworkInterfaceIPConfigurationClient')
211+
sd 'CreateNewSubnetClient' 'CreateSubnetClient' $(rg -l 'CreateNewSubnetClient')
212+
sd 'CreateNewVirtualNetworkClient' 'CreateVirtualNetworkClient' $(rg -l 'CreateNewVirtualNetworkClient')
213+
214+
# NsgRuleSummary typo
215+
sd 'SourceAdresssPrefixes' 'SourceAddressPrefixes' $(rg -l 'SourceAdresssPrefixes')
216+
```
217+
218+
For the SDK migration itself we recommend doing one Azure service at a
219+
time, starting with the import path, then fixing the resulting compile
220+
errors (type names, `.Properties` access, pager loops). The Go compiler
221+
is the most reliable migration tool here.
222+
223+
## Need help
224+
225+
Open an issue on the Terratest repo with the `azure` label and a snippet
226+
of the failing code. If you spot a gap in this guide, please send a PR
227+
against `docs/_docs/03_migrating-to-v1/azure.md`.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ require (
9999
github.com/lib/pq v1.10.9
100100
github.com/microsoft/go-mssqldb v1.9.8
101101
github.com/slack-go/slack v0.15.0
102+
golang.org/x/sync v0.20.0
102103
google.golang.org/grpc v1.80.0
103104
gopkg.in/yaml.v3 v3.0.1
104105
gotest.tools/v3 v3.5.2
@@ -223,7 +224,6 @@ require (
223224
go.yaml.in/yaml/v2 v2.4.3 // indirect
224225
go.yaml.in/yaml/v3 v3.0.4 // indirect
225226
golang.org/x/mod v0.33.0 // indirect
226-
golang.org/x/sync v0.20.0 // indirect
227227
golang.org/x/sys v0.42.0 // indirect
228228
golang.org/x/term v0.41.0 // indirect
229229
golang.org/x/text v0.35.0 // indirect

modules/aws/account.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,17 @@ func GetAccountIDE(t testing.TestingT) (string, error) {
5959
return GetAccountIDContextE(t, context.Background())
6060
}
6161

62+
// GetAccountId gets the Account ID for the currently logged in IAM User.
63+
//
6264
// Deprecated: Use [GetAccountID] instead.
6365
//
6466
//nolint:staticcheck,revive // preserving deprecated function name
6567
func GetAccountId(t testing.TestingT) string {
6668
return GetAccountID(t)
6769
}
6870

71+
// GetAccountIdE gets the Account ID for the currently logged in IAM User.
72+
//
6973
// Deprecated: Use [GetAccountIDE] instead.
7074
//
7175
//nolint:staticcheck,revive // preserving deprecated function name

modules/aws/ami.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,19 @@ func GetMostRecentAmiIDE(t testing.TestingT, region string, ownerID string, filt
209209
return GetMostRecentAmiIDContextE(t, context.Background(), region, ownerID, filters)
210210
}
211211

212+
// GetMostRecentAmiId gets the ID of the most recent AMI in the given region that has the given owner and matches
213+
// the given filters.
214+
//
212215
// Deprecated: Use [GetMostRecentAmiID] instead.
213216
//
214217
//nolint:staticcheck,revive // preserving deprecated function name
215218
func GetMostRecentAmiId(t testing.TestingT, region string, ownerId string, filters map[string][]string) string {
216219
return GetMostRecentAmiID(t, region, ownerId, filters)
217220
}
218221

222+
// GetMostRecentAmiIdE gets the ID of the most recent AMI in the given region that has the given owner and matches
223+
// the given filters.
224+
//
219225
// Deprecated: Use [GetMostRecentAmiIDE] instead.
220226
//
221227
//nolint:staticcheck,revive // preserving deprecated function name

modules/aws/auth.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ import (
1717
)
1818

1919
const (
20-
AuthAssumeRoleEnvVar = "TERRATEST_IAM_ROLE" // OS environment variable name through which Assume Role ARN may be passed for authentication
20+
// AuthAssumeRoleEnvVar is the OS environment variable name through which an
21+
// Assume Role ARN may be passed for authentication.
22+
AuthAssumeRoleEnvVar = "TERRATEST_IAM_ROLE"
2123
)
2224

2325
// NewAuthenticatedSessionContext creates an AWS Config following to standard AWS authentication workflow.

modules/aws/dynamodb.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ func GetDynamoDBTableTagsE(t testing.TestingT, region string, tableName string)
7474
return GetDynamoDBTableTagsContextE(t, context.Background(), region, tableName)
7575
}
7676

77+
// GetDynamoDbTableTags fetches resource tags of a specified dynamoDB table. This will fail the test if there are any errors.
78+
//
7779
// Deprecated: Use [GetDynamoDBTableTagsContext] instead.
7880
//
7981
//nolint:staticcheck,revive // preserving deprecated function name
@@ -82,6 +84,8 @@ func GetDynamoDbTableTags(t testing.TestingT, region string, tableName string) [
8284
return GetDynamoDBTableTagsContext(t, context.Background(), region, tableName)
8385
}
8486

87+
// GetDynamoDbTableTagsE fetches resource tags of a specified dynamoDB table.
88+
//
8589
// Deprecated: Use [GetDynamoDBTableTagsContextE] instead.
8690
//
8791
//nolint:staticcheck,revive // preserving deprecated function name

modules/aws/ec2-files.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,10 @@ func FetchFilesFromAsgsPE(t testing.TestingT, awsRegion string, spec *RemoteFile
394394
return FetchFilesFromAsgsPContextE(t, context.Background(), awsRegion, spec)
395395
}
396396

397+
// FetchFilesFromAsgs looks up the EC2 Instances in all the ASGs given in the
398+
// RemoteFileSpecification, downloads the matching files from each instance,
399+
// and stores them locally as described in [FetchFilesFromAsgsPContext].
400+
//
397401
// Deprecated: Use [FetchFilesFromAsgsPContext] instead.
398402
//
399403
//nolint:staticcheck,revive,gocritic // preserving deprecated function name
@@ -403,6 +407,8 @@ func FetchFilesFromAsgs(t testing.TestingT, awsRegion string, spec RemoteFileSpe
403407
FetchFilesFromAsgsPContext(t, context.Background(), awsRegion, &spec)
404408
}
405409

410+
// FetchFilesFromAsgsE is the error-returning equivalent of [FetchFilesFromAsgs].
411+
//
406412
// Deprecated: Use [FetchFilesFromAsgsPContextE] instead.
407413
//
408414
//nolint:staticcheck,revive,gocritic // preserving deprecated function name

modules/aws/errors.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
)
66

77
// IpForEc2InstanceNotFound is an error that occurs when the IP for an EC2 instance is not found.
8+
//
9+
// Deprecated: Use [IPForEc2InstanceNotFound] instead.
810
type IpForEc2InstanceNotFound struct { //nolint:staticcheck,revive // preserving deprecated type name
911
InstanceId string //nolint:staticcheck,revive // preserving existing field name
1012
AwsRegion string
@@ -40,6 +42,7 @@ func (err NotFoundError) Error() string {
4042
return fmt.Sprintf("Object of type %s with id %s not found in region %s", err.objectType, err.objectID, err.region)
4143
}
4244

45+
// NewNotFoundError returns a [NotFoundError] for the given object type, ID, and region.
4346
func NewNotFoundError(objectType string, objectID string, region string) NotFoundError {
4447
return NotFoundError{objectType, objectID, region}
4548
}
@@ -60,6 +63,8 @@ func (err AsgCapacityNotMetError) Error() string {
6063
)
6164
}
6265

66+
// NewAsgCapacityNotMetError returns an [AsgCapacityNotMetError] describing
67+
// the given ASG's desired and current capacities.
6368
func NewAsgCapacityNotMetError(asgName string, desiredCapacity int64, currentCapacity int64) AsgCapacityNotMetError {
6469
return AsgCapacityNotMetError{asgName, desiredCapacity, currentCapacity}
6570
}
@@ -80,6 +85,8 @@ func (err BucketVersioningNotEnabledError) Error() string {
8085
)
8186
}
8287

88+
// NewBucketVersioningNotEnabledError returns a [BucketVersioningNotEnabledError]
89+
// for the given S3 bucket, region, and observed versioning status.
8390
func NewBucketVersioningNotEnabledError(s3BucketName string, awsRegion string, versioningStatus string) BucketVersioningNotEnabledError {
8491
return BucketVersioningNotEnabledError{s3BucketName: s3BucketName, awsRegion: awsRegion, versioningStatus: versioningStatus}
8592
}
@@ -99,6 +106,8 @@ func (err NoBucketPolicyError) Error() string {
99106
)
100107
}
101108

109+
// NewNoBucketPolicyError returns a [NoBucketPolicyError] for the given S3
110+
// bucket, region, and bucket policy.
102111
func NewNoBucketPolicyError(s3BucketName string, awsRegion string, bucketPolicy string) NoBucketPolicyError {
103112
return NoBucketPolicyError{s3BucketName: s3BucketName, awsRegion: awsRegion, bucketPolicy: bucketPolicy}
104113
}

0 commit comments

Comments
 (0)