/*******************************************************************************
* 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 Network File System (NFS) 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 NFS interface. This operation
/// is only supported for S3 File Gateways.
///
///
/// S3 File gateway requires Security Token Service (Amazon Web Services STS) to be activated
/// to enable you to create a file share. Make sure 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 the 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.
///
/// S3 File Gateways do not support creating hard or symbolic links on a file share.
///
///
[Cmdlet("New", "SGNFSFileShare", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)]
[OutputType("System.String")]
[AWSCmdlet("Calls the AWS Storage Gateway CreateNFSFileShare API operation.", Operation = new[] {"CreateNFSFileShare"}, SelectReturnType = typeof(Amazon.StorageGateway.Model.CreateNFSFileShareResponse))]
[AWSCmdletOutput("System.String or Amazon.StorageGateway.Model.CreateNFSFileShareResponse",
"This cmdlet returns a System.String object.",
"The service call response (type Amazon.StorageGateway.Model.CreateNFSFileShareResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack."
)]
public partial class NewSGNFSFileShareCmdlet : AmazonStorageGatewayClientCmdlet, IExecutor
{
#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 BucketRegion
///
///
/// Specifies the Region of the S3 bucket where the NFS file share stores files.This parameter is required for NFS 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 ClientList
///
///
/// The list of clients that are allowed to access the S3 File Gateway. The list must
/// contain either valid IP addresses or valid CIDR blocks.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String[] ClientList { 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 NFSFileShareDefaults_DirectoryMode
///
///
/// The Unix directory mode in the form "nnnn". For example, 0666
represents
/// the default access mode for all directories inside the file share. The default value
/// is 0777
.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String NFSFileShareDefaults_DirectoryMode { get; set; }
#endregion
#region Parameter NFSFileShareDefaults_FileMode
///
///
/// The Unix file mode in the form "nnnn". For example, 0666
represents the
/// default file mode inside the file share. The default value is 0666
.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String NFSFileShareDefaults_FileMode { 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 Amazon Resource Name (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 NFSFileShareDefaults_GroupId
///
///
/// The default group ID for the file share (unless the files have another group ID specified).
/// The default value is nfsnobody
.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Int64? NFSFileShareDefaults_GroupId { 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 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 NFSFileShareDefaults_OwnerId
///
///
/// The default owner ID for files in the file share (unless the files have another owner
/// ID specified). The default value is nfsnobody
.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Int64? NFSFileShareDefaults_OwnerId { 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 Squash
///
///
/// A value that maps a user to anonymous user.Valid values are the following:RootSquash
: Only root is mapped to anonymous user.NoSquash
: No one is mapped to anonymous user.AllSquash
: Everyone is mapped to anonymous user.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String Squash { 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 VPCEndpointDNSName
///
///
/// Specifies the DNS name for the VPC endpoint that the NFS file share uses to connect
/// to Amazon S3.This parameter is required for NFS 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.CreateNFSFileShareResponse).
/// Specifying the name of a property of type Amazon.StorageGateway.Model.CreateNFSFileShareResponse 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-SGNFSFileShare (CreateNFSFileShare)"))
{
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.AuditDestinationARN = this.AuditDestinationARN;
context.BucketRegion = this.BucketRegion;
context.CacheAttributes_CacheStaleTimeoutInSecond = this.CacheAttributes_CacheStaleTimeoutInSecond;
if (this.ClientList != null)
{
context.ClientList = new List(this.ClientList);
}
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;
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.NFSFileShareDefaults_DirectoryMode = this.NFSFileShareDefaults_DirectoryMode;
context.NFSFileShareDefaults_FileMode = this.NFSFileShareDefaults_FileMode;
context.NFSFileShareDefaults_GroupId = this.NFSFileShareDefaults_GroupId;
context.NFSFileShareDefaults_OwnerId = this.NFSFileShareDefaults_OwnerId;
context.NotificationPolicy = this.NotificationPolicy;
context.ObjectACL = this.ObjectACL;
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.Squash = this.Squash;
if (this.Tag != null)
{
context.Tag = new List(this.Tag);
}
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.CreateNFSFileShareRequest();
if (cmdletContext.AuditDestinationARN != null)
{
request.AuditDestinationARN = cmdletContext.AuditDestinationARN;
}
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.ClientList != null)
{
request.ClientList = cmdletContext.ClientList;
}
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.KMSEncrypted != null)
{
request.KMSEncrypted = cmdletContext.KMSEncrypted.Value;
}
if (cmdletContext.KMSKey != null)
{
request.KMSKey = cmdletContext.KMSKey;
}
if (cmdletContext.LocationARN != null)
{
request.LocationARN = cmdletContext.LocationARN;
}
// populate NFSFileShareDefaults
var requestNFSFileShareDefaultsIsNull = true;
request.NFSFileShareDefaults = new Amazon.StorageGateway.Model.NFSFileShareDefaults();
System.String requestNFSFileShareDefaults_nFSFileShareDefaults_DirectoryMode = null;
if (cmdletContext.NFSFileShareDefaults_DirectoryMode != null)
{
requestNFSFileShareDefaults_nFSFileShareDefaults_DirectoryMode = cmdletContext.NFSFileShareDefaults_DirectoryMode;
}
if (requestNFSFileShareDefaults_nFSFileShareDefaults_DirectoryMode != null)
{
request.NFSFileShareDefaults.DirectoryMode = requestNFSFileShareDefaults_nFSFileShareDefaults_DirectoryMode;
requestNFSFileShareDefaultsIsNull = false;
}
System.String requestNFSFileShareDefaults_nFSFileShareDefaults_FileMode = null;
if (cmdletContext.NFSFileShareDefaults_FileMode != null)
{
requestNFSFileShareDefaults_nFSFileShareDefaults_FileMode = cmdletContext.NFSFileShareDefaults_FileMode;
}
if (requestNFSFileShareDefaults_nFSFileShareDefaults_FileMode != null)
{
request.NFSFileShareDefaults.FileMode = requestNFSFileShareDefaults_nFSFileShareDefaults_FileMode;
requestNFSFileShareDefaultsIsNull = false;
}
System.Int64? requestNFSFileShareDefaults_nFSFileShareDefaults_GroupId = null;
if (cmdletContext.NFSFileShareDefaults_GroupId != null)
{
requestNFSFileShareDefaults_nFSFileShareDefaults_GroupId = cmdletContext.NFSFileShareDefaults_GroupId.Value;
}
if (requestNFSFileShareDefaults_nFSFileShareDefaults_GroupId != null)
{
request.NFSFileShareDefaults.GroupId = requestNFSFileShareDefaults_nFSFileShareDefaults_GroupId.Value;
requestNFSFileShareDefaultsIsNull = false;
}
System.Int64? requestNFSFileShareDefaults_nFSFileShareDefaults_OwnerId = null;
if (cmdletContext.NFSFileShareDefaults_OwnerId != null)
{
requestNFSFileShareDefaults_nFSFileShareDefaults_OwnerId = cmdletContext.NFSFileShareDefaults_OwnerId.Value;
}
if (requestNFSFileShareDefaults_nFSFileShareDefaults_OwnerId != null)
{
request.NFSFileShareDefaults.OwnerId = requestNFSFileShareDefaults_nFSFileShareDefaults_OwnerId.Value;
requestNFSFileShareDefaultsIsNull = false;
}
// determine if request.NFSFileShareDefaults should be set to null
if (requestNFSFileShareDefaultsIsNull)
{
request.NFSFileShareDefaults = null;
}
if (cmdletContext.NotificationPolicy != null)
{
request.NotificationPolicy = cmdletContext.NotificationPolicy;
}
if (cmdletContext.ObjectACL != null)
{
request.ObjectACL = cmdletContext.ObjectACL;
}
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.Squash != null)
{
request.Squash = cmdletContext.Squash;
}
if (cmdletContext.Tag != null)
{
request.Tags = cmdletContext.Tag;
}
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.CreateNFSFileShareResponse CallAWSServiceOperation(IAmazonStorageGateway client, Amazon.StorageGateway.Model.CreateNFSFileShareRequest request)
{
Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Storage Gateway", "CreateNFSFileShare");
try
{
#if DESKTOP
return client.CreateNFSFileShare(request);
#elif CORECLR
return client.CreateNFSFileShareAsync(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.String AuditDestinationARN { get; set; }
public System.String BucketRegion { get; set; }
public System.Int32? CacheAttributes_CacheStaleTimeoutInSecond { get; set; }
public List ClientList { 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 System.Boolean? KMSEncrypted { get; set; }
public System.String KMSKey { get; set; }
public System.String LocationARN { get; set; }
public System.String NFSFileShareDefaults_DirectoryMode { get; set; }
public System.String NFSFileShareDefaults_FileMode { get; set; }
public System.Int64? NFSFileShareDefaults_GroupId { get; set; }
public System.Int64? NFSFileShareDefaults_OwnerId { get; set; }
public System.String NotificationPolicy { get; set; }
public Amazon.StorageGateway.ObjectACL ObjectACL { get; set; }
public System.Boolean? ReadOnly { get; set; }
public System.Boolean? RequesterPay { get; set; }
public System.String Role { get; set; }
public System.String Squash { get; set; }
public List Tag { get; set; }
public System.String VPCEndpointDNSName { get; set; }
public System.Func Select { get; set; } =
(response, cmdlet) => response.FileShareARN;
}
}
}