コード例 #1
0
        /// <summary>
        /// Moves a file system and its associated snapshots into a different compartment within the same tenancy.
        /// For information about moving resources between compartments, see Moving Resources to a Different Compartment
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public ChangeFileSystemCompartmentResponse ChangeFileSystemCompartment(ChangeFileSystemCompartmentRequest request)
        {
            var uri = new Uri($"{GetEndPoint(FileStorageServices.FileSystems, this.Region)}/{request.FileSystemId}/actions/changeCompartment");

            var headers = new HttpRequestHeaderParam
            {
                IfMatch      = request.FileSystemId,
                OpcRequestId = request.OpcRequestId
            };

            using (var webResponse = this.RestClient.Post(uri, request.ChangeFileSystemCompartmentDetails, headers))
                using (var stream = webResponse.GetResponseStream())
                    using (var reader = new StreamReader(stream))
                    {
                        var response = reader.ReadToEnd();

                        return(new ChangeFileSystemCompartmentResponse()
                        {
                            ETag = webResponse.Headers.Get("ETag"),
                            OpcRequestId = webResponse.Headers.Get("opc-request-id")
                        });
                    }
        }
コード例 #2
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ChangeFileSystemCompartmentRequest request;

            try
            {
                request = new ChangeFileSystemCompartmentRequest
                {
                    FileSystemId = FileSystemId,
                    ChangeFileSystemCompartmentDetails = ChangeFileSystemCompartmentDetails,
                    IfMatch      = IfMatch,
                    OpcRequestId = OpcRequestId
                };

                response = client.ChangeFileSystemCompartment(request).GetAwaiter().GetResult();
                WriteOutput(response);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }