Skip to content

Commit 1a8573c

Browse files
Adding ForcePathStyleAddressing to S3 cmdlets.
1 parent 9ed7c21 commit 1a8573c

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

modules/AWSPowerShell/Cmdlets/S3/Extensions/ClientCmdlet.Extensions.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,19 @@ public abstract partial class AmazonS3ClientCmdlet
4242
/// </summary>
4343
[Parameter(ValueFromPipelineByPropertyName = true)]
4444
public SwitchParameter UseDualstackEndpoint { get; set; }
45-
45+
46+
#endregion
47+
48+
#region Parameter ForcePathStyleAddressing
49+
/// <summary>
50+
/// S3 requests can be performed using one of two URI styles: Virtual or Path.
51+
/// When using Virtual style, the bucket is included as part of the hostname.
52+
/// When using Path style the bucket is included as part of the URI path.
53+
/// The default value is $true when the EndpointUrl parameter is specified, $false otherwise.
54+
/// </summary>
55+
[Parameter(ValueFromPipelineByPropertyName = true)]
56+
public bool? ForcePathStyleAddressing { get; set; }
57+
4658
#endregion
4759

4860
protected override void CustomizeClientConfig(ClientConfig config)
@@ -63,8 +75,7 @@ protected override void CustomizeClientConfig(ClientConfig config)
6375

6476
// github issue #670 request - like the aws cli, if a specific endpoint is
6577
// given then switch to path style addressing
66-
if (ParameterWasBound(nameof(EndpointUrl)))
67-
s3Config.ForcePathStyle = true;
78+
s3Config.ForcePathStyle = ForcePathStyleAddressing ?? ParameterWasBound(nameof(EndpointUrl));
6879
}
6980
}
7081
}

0 commit comments

Comments
 (0)