コード例 #1
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);
        }
        public static CreateFileSystemResponse Unmarshall(UnmarshallerContext context)
        {
            CreateFileSystemResponse createFileSystemResponse = new CreateFileSystemResponse();

            createFileSystemResponse.HttpResponse = context.HttpResponse;
            createFileSystemResponse.RequestId    = context.StringValue("CreateFileSystem.RequestId");
            createFileSystemResponse.FileSystemId = context.StringValue("CreateFileSystem.FileSystemId");

            return(createFileSystemResponse);
        }
コード例 #3
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            CreateFileSystemResponse response = new CreateFileSystemResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("FileSystem", targetDepth))
                {
                    var unmarshaller = FileSystemUnmarshaller.Instance;
                    response.FileSystem = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
コード例 #4
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            CreateFileSystemResponse response = new CreateFileSystemResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("CreationTime", targetDepth))
                {
                    var unmarshaller = DateTimeUnmarshaller.Instance;
                    response.CreationTime = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("CreationToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.CreationToken = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("Encrypted", targetDepth))
                {
                    var unmarshaller = BoolUnmarshaller.Instance;
                    response.Encrypted = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("FileSystemId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.FileSystemId = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("KmsKeyId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.KmsKeyId = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("LifeCycleState", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.LifeCycleState = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("Name", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Name = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("NumberOfMountTargets", targetDepth))
                {
                    var unmarshaller = IntUnmarshaller.Instance;
                    response.NumberOfMountTargets = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("OwnerId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.OwnerId = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("PerformanceMode", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.PerformanceMode = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("SizeInBytes", targetDepth))
                {
                    var unmarshaller = FileSystemSizeUnmarshaller.Instance;
                    response.SizeInBytes = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }