Пример #1
0
 private Amazon.ElasticFileSystem.Model.CreateAccessPointResponse CallAWSServiceOperation(IAmazonElasticFileSystem client, Amazon.ElasticFileSystem.Model.CreateAccessPointRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic File System", "CreateAccessPoint");
     try
     {
         #if DESKTOP
         return(client.CreateAccessPoint(request));
         #elif CORECLR
         return(client.CreateAccessPointAsync(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;
     }
 }
Пример #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.ElasticFileSystem.Model.CreateAccessPointRequest();

            if (cmdletContext.ClientToken != null)
            {
                request.ClientToken = cmdletContext.ClientToken;
            }
            if (cmdletContext.FileSystemId != null)
            {
                request.FileSystemId = cmdletContext.FileSystemId;
            }

            // populate PosixUser
            var requestPosixUserIsNull = true;

            request.PosixUser = new Amazon.ElasticFileSystem.Model.PosixUser();
            System.Int64?requestPosixUser_posixUser_Gid = null;
            if (cmdletContext.PosixUser_Gid != null)
            {
                requestPosixUser_posixUser_Gid = cmdletContext.PosixUser_Gid.Value;
            }
            if (requestPosixUser_posixUser_Gid != null)
            {
                request.PosixUser.Gid  = requestPosixUser_posixUser_Gid.Value;
                requestPosixUserIsNull = false;
            }
            List <System.Int64> requestPosixUser_posixUser_SecondaryGid = null;

            if (cmdletContext.PosixUser_SecondaryGid != null)
            {
                requestPosixUser_posixUser_SecondaryGid = cmdletContext.PosixUser_SecondaryGid;
            }
            if (requestPosixUser_posixUser_SecondaryGid != null)
            {
                request.PosixUser.SecondaryGids = requestPosixUser_posixUser_SecondaryGid;
                requestPosixUserIsNull          = false;
            }
            System.Int64?requestPosixUser_posixUser_Uid = null;
            if (cmdletContext.PosixUser_Uid != null)
            {
                requestPosixUser_posixUser_Uid = cmdletContext.PosixUser_Uid.Value;
            }
            if (requestPosixUser_posixUser_Uid != null)
            {
                request.PosixUser.Uid  = requestPosixUser_posixUser_Uid.Value;
                requestPosixUserIsNull = false;
            }
            // determine if request.PosixUser should be set to null
            if (requestPosixUserIsNull)
            {
                request.PosixUser = null;
            }

            // populate RootDirectory
            var requestRootDirectoryIsNull = true;

            request.RootDirectory = new Amazon.ElasticFileSystem.Model.RootDirectory();
            System.String requestRootDirectory_rootDirectory_Path = null;
            if (cmdletContext.RootDirectory_Path != null)
            {
                requestRootDirectory_rootDirectory_Path = cmdletContext.RootDirectory_Path;
            }
            if (requestRootDirectory_rootDirectory_Path != null)
            {
                request.RootDirectory.Path = requestRootDirectory_rootDirectory_Path;
                requestRootDirectoryIsNull = false;
            }
            Amazon.ElasticFileSystem.Model.CreationInfo requestRootDirectory_rootDirectory_CreationInfo = null;

            // populate CreationInfo
            var requestRootDirectory_rootDirectory_CreationInfoIsNull = true;

            requestRootDirectory_rootDirectory_CreationInfo = new Amazon.ElasticFileSystem.Model.CreationInfo();
            System.Int64?requestRootDirectory_rootDirectory_CreationInfo_creationInfo_OwnerGid = null;
            if (cmdletContext.CreationInfo_OwnerGid != null)
            {
                requestRootDirectory_rootDirectory_CreationInfo_creationInfo_OwnerGid = cmdletContext.CreationInfo_OwnerGid.Value;
            }
            if (requestRootDirectory_rootDirectory_CreationInfo_creationInfo_OwnerGid != null)
            {
                requestRootDirectory_rootDirectory_CreationInfo.OwnerGid = requestRootDirectory_rootDirectory_CreationInfo_creationInfo_OwnerGid.Value;
                requestRootDirectory_rootDirectory_CreationInfoIsNull    = false;
            }
            System.Int64?requestRootDirectory_rootDirectory_CreationInfo_creationInfo_OwnerUid = null;
            if (cmdletContext.CreationInfo_OwnerUid != null)
            {
                requestRootDirectory_rootDirectory_CreationInfo_creationInfo_OwnerUid = cmdletContext.CreationInfo_OwnerUid.Value;
            }
            if (requestRootDirectory_rootDirectory_CreationInfo_creationInfo_OwnerUid != null)
            {
                requestRootDirectory_rootDirectory_CreationInfo.OwnerUid = requestRootDirectory_rootDirectory_CreationInfo_creationInfo_OwnerUid.Value;
                requestRootDirectory_rootDirectory_CreationInfoIsNull    = false;
            }
            System.String requestRootDirectory_rootDirectory_CreationInfo_creationInfo_Permission = null;
            if (cmdletContext.CreationInfo_Permission != null)
            {
                requestRootDirectory_rootDirectory_CreationInfo_creationInfo_Permission = cmdletContext.CreationInfo_Permission;
            }
            if (requestRootDirectory_rootDirectory_CreationInfo_creationInfo_Permission != null)
            {
                requestRootDirectory_rootDirectory_CreationInfo.Permissions = requestRootDirectory_rootDirectory_CreationInfo_creationInfo_Permission;
                requestRootDirectory_rootDirectory_CreationInfoIsNull       = false;
            }
            // determine if requestRootDirectory_rootDirectory_CreationInfo should be set to null
            if (requestRootDirectory_rootDirectory_CreationInfoIsNull)
            {
                requestRootDirectory_rootDirectory_CreationInfo = null;
            }
            if (requestRootDirectory_rootDirectory_CreationInfo != null)
            {
                request.RootDirectory.CreationInfo = requestRootDirectory_rootDirectory_CreationInfo;
                requestRootDirectoryIsNull         = false;
            }
            // determine if request.RootDirectory should be set to null
            if (requestRootDirectoryIsNull)
            {
                request.RootDirectory = null;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

            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);
        }