/*******************************************************************************
* Copyright 2012-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file.
* This file 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.
* *****************************************************************************
*
* AWS Tools for Windows (TM) PowerShell (TM)
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Text;
using Amazon.PowerShell.Common;
using Amazon.Runtime;
using Amazon.StorageGateway;
using Amazon.StorageGateway.Model;
namespace Amazon.PowerShell.Cmdlets.SG
{
///
/// Creates a Server Message Block (SMB) file share on an existing S3 File Gateway. In
/// Storage Gateway, a file share is a file system mount point backed by Amazon S3 cloud
/// storage. Storage Gateway exposes file shares using an SMB interface. This operation
/// is only supported for S3 File Gateways.
///
///
/// S3 File Gateways require Security Token Service (Amazon Web Services STS) to be activated
/// to enable you to create a file share. Make sure that Amazon Web Services STS is activated
/// in the Amazon Web Services Region you are creating your S3 File Gateway in. If Amazon
/// Web Services STS is not activated in this Amazon Web Services Region, activate it.
/// For information about how to activate Amazon Web Services STS, see Activating
/// and deactivating Amazon Web Services STS in an Amazon Web Services Region in the
/// Identity and Access Management User Guide.
///
/// File gateways don't support creating hard or symbolic links on a file share.
///
///
[Cmdlet("New", "SGSMBFileShare", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)]
[OutputType("System.String")]
[AWSCmdlet("Calls the AWS Storage Gateway CreateSMBFileShare API operation.", Operation = new[] {"CreateSMBFileShare"}, SelectReturnType = typeof(Amazon.StorageGateway.Model.CreateSMBFileShareResponse))]
[AWSCmdletOutput("System.String or Amazon.StorageGateway.Model.CreateSMBFileShareResponse",
"This cmdlet returns a System.String object.",
"The service call response (type Amazon.StorageGateway.Model.CreateSMBFileShareResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack."
)]
public partial class NewSGSMBFileShareCmdlet : AmazonStorageGatewayClientCmdlet, IExecutor
{
#region Parameter AccessBasedEnumeration
///
///
/// The files and folders on this share will only be visible to users with read access.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Boolean? AccessBasedEnumeration { get; set; }
#endregion
#region Parameter AdminUserList
///
///
/// A list of users or groups in the Active Directory that will be granted administrator
/// privileges on the file share. These users can do all file operations as the super-user.
/// Acceptable formats include: DOMAIN\User1
, user1
, @group1
,
/// and @DOMAIN\group1
.Use this option very carefully, because any user in this list can do anything they
/// like on the file share, regardless of file permissions.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String[] AdminUserList { get; set; }
#endregion
#region Parameter AuditDestinationARN
///
///
/// The Amazon Resource Name (ARN) of the storage used for audit logs.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String AuditDestinationARN { get; set; }
#endregion
#region Parameter Authentication
///
///
/// The authentication method that users use to access the file share. The default is
/// ActiveDirectory
.Valid Values: ActiveDirectory
| GuestAccess
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String Authentication { get; set; }
#endregion
#region Parameter BucketRegion
///
///
/// Specifies the Region of the S3 bucket where the SMB file share stores files.This parameter is required for SMB file shares that connect to Amazon S3 through a
/// VPC endpoint, a VPC access point, or an access point alias that points to a VPC access
/// point.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String BucketRegion { get; set; }
#endregion
#region Parameter CacheAttributes_CacheStaleTimeoutInSecond
///
///
/// Refreshes a file share's cache by using Time To Live (TTL). TTL is the length of time
/// since the last refresh after which access to the directory would cause the file gateway
/// to first refresh that directory's contents from the Amazon S3 bucket or Amazon FSx
/// file system. The TTL duration is in seconds.Valid Values:0, 300 to 2,592,000 seconds (5 minutes to 30 days)
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("CacheAttributes_CacheStaleTimeoutInSeconds")]
public System.Int32? CacheAttributes_CacheStaleTimeoutInSecond { get; set; }
#endregion
#region Parameter CaseSensitivity
///
///
/// The case of an object name in an Amazon S3 bucket. For ClientSpecified
,
/// the client determines the case sensitivity. For CaseSensitive
, the gateway
/// determines the case sensitivity. The default value is ClientSpecified
.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[AWSConstantClassSource("Amazon.StorageGateway.CaseSensitivity")]
public Amazon.StorageGateway.CaseSensitivity CaseSensitivity { get; set; }
#endregion
#region Parameter DefaultStorageClass
///
///
/// The default storage class for objects put into an Amazon S3 bucket by the S3 File
/// Gateway. The default value is S3_STANDARD
. Optional.Valid Values: S3_STANDARD
| S3_INTELLIGENT_TIERING
| S3_STANDARD_IA
/// | S3_ONEZONE_IA
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String DefaultStorageClass { get; set; }
#endregion
#region Parameter FileShareName
///
///
/// The name of the file share. Optional.FileShareName
must be set if an S3 prefix name is set in LocationARN
,
/// or if an access point or access point alias is used.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String FileShareName { get; set; }
#endregion
#region Parameter GatewayARN
///
///
/// The ARN of the S3 File Gateway on which you want to create a file share.
///
///
#if !MODULAR
[System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true)]
#else
[System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true, Mandatory = true)]
[System.Management.Automation.AllowEmptyString]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public System.String GatewayARN { get; set; }
#endregion
#region Parameter GuessMIMETypeEnabled
///
///
/// A value that enables guessing of the MIME type for uploaded objects based on file
/// extensions. Set this value to true
to enable MIME type guessing, otherwise
/// set to false
. The default value is true
.Valid Values: true
| false
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Boolean? GuessMIMETypeEnabled { get; set; }
#endregion
#region Parameter InvalidUserList
///
///
/// A list of users or groups in the Active Directory that are not allowed to access the
/// file share. A group must be prefixed with the @ character. Acceptable formats include:
/// DOMAIN\User1
, user1
, @group1
, and @DOMAIN\group1
.
/// Can only be set if Authentication is set to ActiveDirectory
.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String[] InvalidUserList { get; set; }
#endregion
#region Parameter KMSEncrypted
///
///
/// Set to true
to use Amazon S3 server-side encryption with your own KMS
/// key, or false
to use a key managed by Amazon S3. Optional.Valid Values: true
| false
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Boolean? KMSEncrypted { get; set; }
#endregion
#region Parameter KMSKey
///
///
/// The Amazon Resource Name (ARN) of a symmetric customer master key (CMK) used for Amazon
/// S3 server-side encryption. Storage Gateway does not support asymmetric CMKs. This
/// value can only be set when KMSEncrypted
is true
. Optional.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String KMSKey { get; set; }
#endregion
#region Parameter LocationARN
///
///
/// A custom ARN for the backend storage used for storing data for file shares. It includes
/// a resource ARN with an optional prefix concatenation. The prefix must end with a forward
/// slash (/).You can specify LocationARN as a bucket ARN, access point ARN or access point alias,
/// as shown in the following examples.Bucket ARN:arn:aws:s3:::my-bucket/prefix/
Access point ARN:arn:aws:s3:region:account-id:accesspoint/access-point-name/prefix/
If you specify an access point, the bucket policy must be configured to delegate access
/// control to the access point. For information, see Delegating
/// access control to access points in the Amazon S3 User Guide.Access point alias:test-ap-ab123cdef4gehijklmn5opqrstuvuse1a-s3alias
///
///
#if !MODULAR
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
#else
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
[System.Management.Automation.AllowEmptyString]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public System.String LocationARN { get; set; }
#endregion
#region Parameter NotificationPolicy
///
///
/// The notification policy of the file share. SettlingTimeInSeconds
controls
/// the number of seconds to wait after the last point in time a client wrote to a file
/// before generating an ObjectUploaded
notification. Because clients can
/// make many small writes to files, it's best to set this parameter for as long as possible
/// to avoid generating multiple notifications for the same file in a small time period.SettlingTimeInSeconds
has no effect on the timing of the object uploading
/// to Amazon S3, only the timing of the notification.The following example sets NotificationPolicy
on with SettlingTimeInSeconds
/// set to 60.{\"Upload\": {\"SettlingTimeInSeconds\": 60}}
The following example sets NotificationPolicy
off.{}
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String NotificationPolicy { get; set; }
#endregion
#region Parameter ObjectACL
///
///
/// A value that sets the access control list (ACL) permission for objects in the S3 bucket
/// that a S3 File Gateway puts objects into. The default value is private
.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[AWSConstantClassSource("Amazon.StorageGateway.ObjectACL")]
public Amazon.StorageGateway.ObjectACL ObjectACL { get; set; }
#endregion
#region Parameter OplocksEnabled
///
///
/// Specifies whether opportunistic locking is enabled for the SMB file share.Enabling opportunistic locking on case-sensitive shares is not recommended for workloads
/// that involve access to files with the same name in different case.Valid Values: true
| false
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Boolean? OplocksEnabled { get; set; }
#endregion
#region Parameter ReadOnly
///
///
/// A value that sets the write status of a file share. Set this value to true
/// to set the write status to read-only, otherwise set to false
.Valid Values: true
| false
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Boolean? ReadOnly { get; set; }
#endregion
#region Parameter RequesterPay
///
///
/// A value that sets who pays the cost of the request and the cost associated with data
/// download from the S3 bucket. If this value is set to true
, the requester
/// pays the costs; otherwise, the S3 bucket owner pays. However, the S3 bucket owner
/// always pays the cost of storing data.RequesterPays
is a configuration for the S3 bucket that backs the file
/// share, so make sure that the configuration on the file share is the same as the S3
/// bucket configuration.Valid Values: true
| false
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("RequesterPays")]
public System.Boolean? RequesterPay { get; set; }
#endregion
#region Parameter Role
///
///
/// The ARN of the Identity and Access Management (IAM) role that an S3 File Gateway assumes
/// when it accesses the underlying storage.
///
///
#if !MODULAR
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
#else
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
[System.Management.Automation.AllowEmptyString]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public System.String Role { get; set; }
#endregion
#region Parameter SMBACLEnabled
///
///
/// Set this value to true
to enable access control list (ACL) on the SMB
/// file share. Set it to false
to map file and directory permissions to
/// the POSIX permissions.For more information, see Using
/// Microsoft Windows ACLs to control access to an SMB file share in the Storage
/// Gateway User Guide.Valid Values: true
| false
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Boolean? SMBACLEnabled { get; set; }
#endregion
#region Parameter Tag
///
///
/// A list of up to 50 tags that can be assigned to the NFS file share. Each tag is a
/// key-value pair.Valid characters for key and value are letters, spaces, and numbers representable
/// in UTF-8 format, and the following special characters: + - = . _ : / @. The maximum
/// length of a tag's key is 128 characters, and the maximum length for a tag's value
/// is 256.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("Tags")]
public Amazon.StorageGateway.Model.Tag[] Tag { get; set; }
#endregion
#region Parameter ValidUserList
///
///
/// A list of users or groups in the Active Directory that are allowed to access the file
/// share. A group must be prefixed with the @ character. Acceptable formats
/// include: DOMAIN\User1
, user1
, @group1
, and
/// @DOMAIN\group1
. Can only be set if Authentication is set to ActiveDirectory
.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String[] ValidUserList { get; set; }
#endregion
#region Parameter VPCEndpointDNSName
///
///
/// Specifies the DNS name for the VPC endpoint that the SMB file share uses to connect
/// to Amazon S3.This parameter is required for SMB file shares that connect to Amazon S3 through a
/// VPC endpoint, a VPC access point, or an access point alias that points to a VPC access
/// point.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String VPCEndpointDNSName { get; set; }
#endregion
#region Parameter ClientToken
///
///
/// A unique string value that you supply that is used by S3 File Gateway to ensure idempotent
/// file share creation.
///
///
#if !MODULAR
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
#else
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
[System.Management.Automation.AllowEmptyString]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public System.String ClientToken { get; set; }
#endregion
#region Parameter Select
///
/// Use the -Select parameter to control the cmdlet output. The default value is 'FileShareARN'.
/// Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.StorageGateway.Model.CreateSMBFileShareResponse).
/// Specifying the name of a property of type Amazon.StorageGateway.Model.CreateSMBFileShareResponse will result in that property being returned.
/// Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value.
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public string Select { get; set; } = "FileShareARN";
#endregion
#region Parameter PassThru
///
/// Changes the cmdlet behavior to return the value passed to the GatewayARN parameter.
/// The -PassThru parameter is deprecated, use -Select '^GatewayARN' instead. This parameter will be removed in a future version.
///
[System.Obsolete("The -PassThru parameter is deprecated, use -Select '^GatewayARN' instead. This parameter will be removed in a future version.")]
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public SwitchParameter PassThru { get; set; }
#endregion
#region Parameter Force
///
/// This parameter overrides confirmation prompts to force
/// the cmdlet to continue its operation. This parameter should always
/// be used with caution.
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public SwitchParameter Force { get; set; }
#endregion
protected override void ProcessRecord()
{
this._AWSSignerType = "v4";
base.ProcessRecord();
var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.GatewayARN), MyInvocation.BoundParameters);
if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "New-SGSMBFileShare (CreateSMBFileShare)"))
{
return;
}
var context = new CmdletContext();
// allow for manipulation of parameters prior to loading into context
PreExecutionContextLoad(context);
#pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute
if (ParameterWasBound(nameof(this.Select)))
{
context.Select = CreateSelectDelegate(Select) ??
throw new System.ArgumentException("Invalid value for -Select parameter.", nameof(this.Select));
if (this.PassThru.IsPresent)
{
throw new System.ArgumentException("-PassThru cannot be used when -Select is specified.", nameof(this.Select));
}
}
else if (this.PassThru.IsPresent)
{
context.Select = (response, cmdlet) => this.GatewayARN;
}
#pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
context.AccessBasedEnumeration = this.AccessBasedEnumeration;
if (this.AdminUserList != null)
{
context.AdminUserList = new List(this.AdminUserList);
}
context.AuditDestinationARN = this.AuditDestinationARN;
context.Authentication = this.Authentication;
context.BucketRegion = this.BucketRegion;
context.CacheAttributes_CacheStaleTimeoutInSecond = this.CacheAttributes_CacheStaleTimeoutInSecond;
context.CaseSensitivity = this.CaseSensitivity;
context.ClientToken = this.ClientToken;
#if MODULAR
if (this.ClientToken == null && ParameterWasBound(nameof(this.ClientToken)))
{
WriteWarning("You are passing $null as a value for parameter ClientToken which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
context.DefaultStorageClass = this.DefaultStorageClass;
context.FileShareName = this.FileShareName;
context.GatewayARN = this.GatewayARN;
#if MODULAR
if (this.GatewayARN == null && ParameterWasBound(nameof(this.GatewayARN)))
{
WriteWarning("You are passing $null as a value for parameter GatewayARN which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
context.GuessMIMETypeEnabled = this.GuessMIMETypeEnabled;
if (this.InvalidUserList != null)
{
context.InvalidUserList = new List(this.InvalidUserList);
}
context.KMSEncrypted = this.KMSEncrypted;
context.KMSKey = this.KMSKey;
context.LocationARN = this.LocationARN;
#if MODULAR
if (this.LocationARN == null && ParameterWasBound(nameof(this.LocationARN)))
{
WriteWarning("You are passing $null as a value for parameter LocationARN which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
context.NotificationPolicy = this.NotificationPolicy;
context.ObjectACL = this.ObjectACL;
context.OplocksEnabled = this.OplocksEnabled;
context.ReadOnly = this.ReadOnly;
context.RequesterPay = this.RequesterPay;
context.Role = this.Role;
#if MODULAR
if (this.Role == null && ParameterWasBound(nameof(this.Role)))
{
WriteWarning("You are passing $null as a value for parameter Role which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
context.SMBACLEnabled = this.SMBACLEnabled;
if (this.Tag != null)
{
context.Tag = new List(this.Tag);
}
if (this.ValidUserList != null)
{
context.ValidUserList = new List(this.ValidUserList);
}
context.VPCEndpointDNSName = this.VPCEndpointDNSName;
// allow further manipulation of loaded context prior to processing
PostExecutionContextLoad(context);
var output = Execute(context) as CmdletOutput;
ProcessOutput(output);
}
#region IExecutor Members
public object Execute(ExecutorContext context)
{
var cmdletContext = context as CmdletContext;
// create request
var request = new Amazon.StorageGateway.Model.CreateSMBFileShareRequest();
if (cmdletContext.AccessBasedEnumeration != null)
{
request.AccessBasedEnumeration = cmdletContext.AccessBasedEnumeration.Value;
}
if (cmdletContext.AdminUserList != null)
{
request.AdminUserList = cmdletContext.AdminUserList;
}
if (cmdletContext.AuditDestinationARN != null)
{
request.AuditDestinationARN = cmdletContext.AuditDestinationARN;
}
if (cmdletContext.Authentication != null)
{
request.Authentication = cmdletContext.Authentication;
}
if (cmdletContext.BucketRegion != null)
{
request.BucketRegion = cmdletContext.BucketRegion;
}
// populate CacheAttributes
var requestCacheAttributesIsNull = true;
request.CacheAttributes = new Amazon.StorageGateway.Model.CacheAttributes();
System.Int32? requestCacheAttributes_cacheAttributes_CacheStaleTimeoutInSecond = null;
if (cmdletContext.CacheAttributes_CacheStaleTimeoutInSecond != null)
{
requestCacheAttributes_cacheAttributes_CacheStaleTimeoutInSecond = cmdletContext.CacheAttributes_CacheStaleTimeoutInSecond.Value;
}
if (requestCacheAttributes_cacheAttributes_CacheStaleTimeoutInSecond != null)
{
request.CacheAttributes.CacheStaleTimeoutInSeconds = requestCacheAttributes_cacheAttributes_CacheStaleTimeoutInSecond.Value;
requestCacheAttributesIsNull = false;
}
// determine if request.CacheAttributes should be set to null
if (requestCacheAttributesIsNull)
{
request.CacheAttributes = null;
}
if (cmdletContext.CaseSensitivity != null)
{
request.CaseSensitivity = cmdletContext.CaseSensitivity;
}
if (cmdletContext.ClientToken != null)
{
request.ClientToken = cmdletContext.ClientToken;
}
if (cmdletContext.DefaultStorageClass != null)
{
request.DefaultStorageClass = cmdletContext.DefaultStorageClass;
}
if (cmdletContext.FileShareName != null)
{
request.FileShareName = cmdletContext.FileShareName;
}
if (cmdletContext.GatewayARN != null)
{
request.GatewayARN = cmdletContext.GatewayARN;
}
if (cmdletContext.GuessMIMETypeEnabled != null)
{
request.GuessMIMETypeEnabled = cmdletContext.GuessMIMETypeEnabled.Value;
}
if (cmdletContext.InvalidUserList != null)
{
request.InvalidUserList = cmdletContext.InvalidUserList;
}
if (cmdletContext.KMSEncrypted != null)
{
request.KMSEncrypted = cmdletContext.KMSEncrypted.Value;
}
if (cmdletContext.KMSKey != null)
{
request.KMSKey = cmdletContext.KMSKey;
}
if (cmdletContext.LocationARN != null)
{
request.LocationARN = cmdletContext.LocationARN;
}
if (cmdletContext.NotificationPolicy != null)
{
request.NotificationPolicy = cmdletContext.NotificationPolicy;
}
if (cmdletContext.ObjectACL != null)
{
request.ObjectACL = cmdletContext.ObjectACL;
}
if (cmdletContext.OplocksEnabled != null)
{
request.OplocksEnabled = cmdletContext.OplocksEnabled.Value;
}
if (cmdletContext.ReadOnly != null)
{
request.ReadOnly = cmdletContext.ReadOnly.Value;
}
if (cmdletContext.RequesterPay != null)
{
request.RequesterPays = cmdletContext.RequesterPay.Value;
}
if (cmdletContext.Role != null)
{
request.Role = cmdletContext.Role;
}
if (cmdletContext.SMBACLEnabled != null)
{
request.SMBACLEnabled = cmdletContext.SMBACLEnabled.Value;
}
if (cmdletContext.Tag != null)
{
request.Tags = cmdletContext.Tag;
}
if (cmdletContext.ValidUserList != null)
{
request.ValidUserList = cmdletContext.ValidUserList;
}
if (cmdletContext.VPCEndpointDNSName != null)
{
request.VPCEndpointDNSName = cmdletContext.VPCEndpointDNSName;
}
CmdletOutput output;
// issue call
var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);
try
{
var response = CallAWSServiceOperation(client, request);
object pipelineOutput = null;
pipelineOutput = cmdletContext.Select(response, this);
output = new CmdletOutput
{
PipelineOutput = pipelineOutput,
ServiceResponse = response
};
}
catch (Exception e)
{
output = new CmdletOutput { ErrorResponse = e };
}
return output;
}
public ExecutorContext CreateContext()
{
return new CmdletContext();
}
#endregion
#region AWS Service Operation Call
private Amazon.StorageGateway.Model.CreateSMBFileShareResponse CallAWSServiceOperation(IAmazonStorageGateway client, Amazon.StorageGateway.Model.CreateSMBFileShareRequest request)
{
Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Storage Gateway", "CreateSMBFileShare");
try
{
#if DESKTOP
return client.CreateSMBFileShare(request);
#elif CORECLR
return client.CreateSMBFileShareAsync(request).GetAwaiter().GetResult();
#else
#error "Unknown build edition"
#endif
}
catch (AmazonServiceException exc)
{
var webException = exc.InnerException as System.Net.WebException;
if (webException != null)
{
throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
}
throw;
}
}
#endregion
internal partial class CmdletContext : ExecutorContext
{
public System.Boolean? AccessBasedEnumeration { get; set; }
public List AdminUserList { get; set; }
public System.String AuditDestinationARN { get; set; }
public System.String Authentication { get; set; }
public System.String BucketRegion { get; set; }
public System.Int32? CacheAttributes_CacheStaleTimeoutInSecond { get; set; }
public Amazon.StorageGateway.CaseSensitivity CaseSensitivity { get; set; }
public System.String ClientToken { get; set; }
public System.String DefaultStorageClass { get; set; }
public System.String FileShareName { get; set; }
public System.String GatewayARN { get; set; }
public System.Boolean? GuessMIMETypeEnabled { get; set; }
public List InvalidUserList { get; set; }
public System.Boolean? KMSEncrypted { get; set; }
public System.String KMSKey { get; set; }
public System.String LocationARN { get; set; }
public System.String NotificationPolicy { get; set; }
public Amazon.StorageGateway.ObjectACL ObjectACL { get; set; }
public System.Boolean? OplocksEnabled { get; set; }
public System.Boolean? ReadOnly { get; set; }
public System.Boolean? RequesterPay { get; set; }
public System.String Role { get; set; }
public System.Boolean? SMBACLEnabled { get; set; }
public List Tag { get; set; }
public List ValidUserList { get; set; }
public System.String VPCEndpointDNSName { get; set; }
public System.Func Select { get; set; } =
(response, cmdlet) => response.FileShareARN;
}
}
}