コード例 #1
0
        /// <summary>
        /// Creates a new, empty file system. The operation requires a creation token in the request
        /// that Amazon EFS uses to ensure idempotent creation (calling the operation with same
        /// creation token has no effect). If a file system does not currently exist that is owned
        /// by the caller's AWS account with the specified creation token, this operation does
        /// the following:
        ///
        ///  <ul> <li>
        /// <para>
        /// Creates a new, empty file system. The file system will have an Amazon EFS assigned
        /// ID, and an initial lifecycle state <code>creating</code>.
        /// </para>
        ///  </li> <li>
        /// <para>
        /// Returns with the description of the created file system.
        /// </para>
        ///  </li> </ul>
        /// <para>
        /// Otherwise, this operation returns a <code>FileSystemAlreadyExists</code> error with
        /// the ID of the existing file system.
        /// </para>
        ///  <note>
        /// <para>
        /// For basic use cases, you can use a randomly generated UUID for the creation token.
        /// </para>
        ///  </note>
        /// <para>
        ///  The idempotent operation allows you to retry a <code>CreateFileSystem</code> call
        /// without risk of creating an extra file system. This can happen when an initial call
        /// fails in a way that leaves it uncertain whether or not a file system was actually
        /// created. An example might be that a transport level timeout occurred or your connection
        /// was reset. As long as you use the same creation token, if the initial call had succeeded
        /// in creating a file system, the client can learn of its existence from the <code>FileSystemAlreadyExists</code>
        /// error.
        /// </para>
        ///  <note>
        /// <para>
        /// The <code>CreateFileSystem</code> call returns while the file system's lifecycle state
        /// is still <code>creating</code>. You can check the file system creation status by calling
        /// the <a>DescribeFileSystems</a> operation, which among other things returns the file
        /// system state.
        /// </para>
        ///  </note>
        /// <para>
        /// This operation also takes an optional <code>PerformanceMode</code> parameter that
        /// you choose for your file system. We recommend <code>generalPurpose</code> performance
        /// mode for most file systems. File systems using the <code>maxIO</code> performance
        /// mode can scale to higher levels of aggregate throughput and operations per second
        /// with a tradeoff of slightly higher latencies for most file operations. The performance
        /// mode can't be changed after the file system has been created. For more information,
        /// see <a href="http://docs.aws.amazon.com/efs/latest/ug/performance.html#performancemodes.html">Amazon
        /// EFS: Performance Modes</a>.
        /// </para>
        ///
        /// <para>
        /// After the file system is fully created, Amazon EFS sets its lifecycle state to <code>available</code>,
        /// at which point you can create one or more mount targets for the file system in your
        /// VPC. For more information, see <a>CreateMountTarget</a>. You mount your Amazon EFS
        /// file system on an EC2 instances in your VPC via the mount target. For more information,
        /// see <a href="http://docs.aws.amazon.com/efs/latest/ug/how-it-works.html">Amazon EFS:
        /// How it Works</a>.
        /// </para>
        ///
        /// <para>
        ///  This operation requires permissions for the <code>elasticfilesystem:CreateFileSystem</code>
        /// action.
        /// </para>
        /// </summary>
        /// <param name="creationToken">String of up to 64 ASCII characters. Amazon EFS uses this to ensure idempotent creation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        ///
        /// <returns>The response from the CreateFileSystem service method, as returned by ElasticFileSystem.</returns>
        /// <exception cref="Amazon.ElasticFileSystem.Model.BadRequestException">
        /// Returned if the request is malformed or contains an error such as an invalid parameter
        /// value or a missing required parameter.
        /// </exception>
        /// <exception cref="Amazon.ElasticFileSystem.Model.FileSystemAlreadyExistsException">
        /// Returned if the file system you are trying to create already exists, with the creation
        /// token you provided.
        /// </exception>
        /// <exception cref="Amazon.ElasticFileSystem.Model.FileSystemLimitExceededException">
        /// Returned if the AWS account has already created maximum number of file systems allowed
        /// per account.
        /// </exception>
        /// <exception cref="Amazon.ElasticFileSystem.Model.InternalServerErrorException">
        /// Returned if an error occurred on the server side.
        /// </exception>
        public Task <CreateFileSystemResponse> CreateFileSystemAsync(string creationToken, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var request = new CreateFileSystemRequest();

            request.CreationToken = creationToken;
            return(CreateFileSystemAsync(request, cancellationToken));
        }
コード例 #2
0
        /**
         * Creates a file system and waits for it to become available. We recommend to retry these requests
         * so that if you receive a timeout or server error and you won't run into the risk of creating multiple resources.
         *
         * @param fsClient the service client to use to create the File System
         * @param compartmentId the OCID of the compartment where the file system will be created
         * @param availabilityDomain the availability domain where the file system will be created
         *
         * @return the created file system
         */
        private static async Task <FileSystem> CreateFileSystem(FileStorageClient fsClient, string compartmentId,
                                                                string displayName, AvailabilityDomain availabilityDomain)
        {
            logger.Info("Creating file system......");

            CreateFileSystemDetails createDetails = new CreateFileSystemDetails
            {
                DisplayName        = displayName,
                CompartmentId      = compartmentId,
                AvailabilityDomain = availabilityDomain.Name
            };
            CreateFileSystemRequest createRequest = new CreateFileSystemRequest
            {
                CreateFileSystemDetails = createDetails
            };
            CreateFileSystemResponse createResponse = await fsClient.CreateFileSystem(createRequest, new RetryConfiguration
            {
                MaxAttempts = 5
            });

            logger.Info($"Created file system: {createResponse.FileSystem.DisplayName}");

            GetFileSystemRequest getRequest = new GetFileSystemRequest
            {
                FileSystemId = createResponse.FileSystem.Id
            };
            GetFileSystemResponse getResponse = fsClient.Waiters.ForFileSystem(getRequest, FileSystem.LifecycleStateEnum.Active).Execute();

            logger.Info($"Waited for file system to become available: {createResponse.FileSystem.DisplayName}");

            return(getResponse.FileSystem);
        }
コード例 #3
0
        internal CreateFileSystemResponse CreateFileSystem(CreateFileSystemRequest request)
        {
            var marshaller   = new CreateFileSystemRequestMarshaller();
            var unmarshaller = CreateFileSystemResponseUnmarshaller.Instance;

            return(Invoke <CreateFileSystemRequest, CreateFileSystemResponse>(request, marshaller, unmarshaller));
        }
コード例 #4
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateFileSystem operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the CreateFileSystem operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task <CreateFileSystemResponse> CreateFileSystemAsync(CreateFileSystemRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new CreateFileSystemRequestMarshaller();
            var unmarshaller = CreateFileSystemResponseUnmarshaller.Instance;

            return(InvokeAsync <CreateFileSystemRequest, CreateFileSystemResponse>(request, marshaller,
                                                                                   unmarshaller, cancellationToken));
        }
コード例 #5
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateFileSystem operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the CreateFileSystem operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/fsx-2018-03-01/CreateFileSystem">REST API Reference for CreateFileSystem Operation</seealso>
        public virtual Task <CreateFileSystemResponse> CreateFileSystemAsync(CreateFileSystemRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = CreateFileSystemRequestMarshaller.Instance;
            options.ResponseUnmarshaller = CreateFileSystemResponseUnmarshaller.Instance;

            return(InvokeAsync <CreateFileSystemResponse>(request, options, cancellationToken));
        }
コード例 #6
0
        internal virtual CreateFileSystemResponse CreateFileSystem(CreateFileSystemRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = CreateFileSystemRequestMarshaller.Instance;
            options.ResponseUnmarshaller = CreateFileSystemResponseUnmarshaller.Instance;

            return(Invoke <CreateFileSystemResponse>(request, options));
        }
コード例 #7
0
        /// <summary>
        /// 创建文件系统(异步)。
        /// </summary>
        /// <param name="req"><see cref="CreateFileSystemRequest"/></param>
        /// <returns><see cref="CreateFileSystemResponse"/></returns>
        public CreateFileSystemResponse CreateFileSystemSync(CreateFileSystemRequest req)
        {
            JsonResponseModel <CreateFileSystemResponse> rsp = null;

            try
            {
                var strResp = this.InternalRequestSync(req, "CreateFileSystem");
                rsp = JsonConvert.DeserializeObject <JsonResponseModel <CreateFileSystemResponse> >(strResp);
            }
            catch (JsonSerializationException e)
            {
                throw new TencentCloudSDKException(e.Message);
            }
            return(rsp.Response);
        }
コード例 #8
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            CreateFileSystemRequest request;

            try
            {
                request = new CreateFileSystemRequest
                {
                    CreateFileSystemDetails = CreateFileSystemDetails,
                    OpcRetryToken           = OpcRetryToken,
                    OpcRequestId            = OpcRequestId
                };

                response = client.CreateFileSystem(request).GetAwaiter().GetResult();
                WriteOutput(response, response.FileSystem);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
コード例 #9
0
        /// <summary>
        /// Creates a new file system in the specified compartment and availability domain. Instances can mount file
        /// systems in another availability domain, but doing so might increase latency when compared to mounting
        /// instances in the same availability domain.
        ///
        /// After you create a file system, you can associate it with a mount target. Instances can then mount the file
        /// system by connecting to the mount target's IP address. You can associate a file system with more than one
        /// mount target at a time.
        ///
        /// For information about access control and compartments, see Overview of the IAM Service.
        ///
        /// For information about availability domains, see Regions and Availability Domains. To get a list of availability
        /// domains, use the ListAvailabilityDomains operation in the Identity and Access Management Service API.
        ///
        /// All Oracle Cloud Infrastructure resources, including file systems, get an Oracle-assigned, unique ID called an
        /// Oracle Cloud Identifier (OCID). When you create a resource, you can find its OCID in the response. You can
        /// also retrieve a resource's OCID by using a List API operation on that resource type or by viewing the resource
        /// in the Console.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <CreateFileSystemResponse> CreateFileSystem(CreateFileSystemRequest request)
        {
            var uri = new Uri($"{GetEndPoint(FileStorageServices.FileSystems, this.Region)}");

            var headers = new HttpRequestHeaderParam()
            {
                OpcRetryToken = request.OpcRetryToken,
                OpcRequestId  = request.OpcRequestId
            };
            var webResponse = await this.RestClientAsync.Post(uri, request.CreateFileSystemDetails, headers);

            using (var stream = webResponse.GetResponseStream())
                using (var reader = new StreamReader(stream))
                {
                    var response = reader.ReadToEnd();

                    return(new CreateFileSystemResponse()
                    {
                        FileSystem = this.JsonSerializer.Deserialize <FileSystem>(response),
                        OpcRequestId = webResponse.Headers.Get("opc-request-id"),
                        ETag = webResponse.Headers.Get("ETag")
                    });
                }
        }
コード例 #10
0
 /// <summary>
 ///  - 创建一个新的文件系统,为这个文件系统分配一个Id
 ///
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public async Task <CreateFileSystemResponse> CreateFileSystem(CreateFileSystemRequest request)
 {
     return(await new CreateFileSystemExecutor().Client(this).Execute <CreateFileSystemResponse, CreateFileSystemResult, CreateFileSystemRequest>(request).ConfigureAwait(false));
 }
コード例 #11
0
 /// <summary>
 ///  - 创建一个新的文件系统,为这个文件系统分配一个Id
 ///
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public CreateFileSystemResponse CreateFileSystem(CreateFileSystemRequest request)
 {
     return(new CreateFileSystemExecutor().Client(this).Execute <CreateFileSystemResponse, CreateFileSystemResult, CreateFileSystemRequest>(request));
 }