/// <summary>
        /// By default, buckets created using the Amazon S3 Compatibility API or the Swift API are created in the root compartment of the Oracle Cloud Infrastructure tenancy.
        ///
        /// You can change the default Swift/Amazon S3 compartmentId designation to a different compartmentId.
        /// All subsequent bucket creations will use the new default compartment, but no previously created buckets will be modified.
        /// A user must have OBJECTSTORAGE_NAMESPACE_UPDATE permission to make changes to the default compartments for Amazon S3 and Swift.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <UpdateNamespaceMetadataResponse> UpdateNamespaceMetadata(UpdateNamespaceMetadataRequest request)
        {
            var uri = new Uri($"{GetEndPointNoneVersion(ObjectStorageServices.Namespace, this.Region)}/{request.NamespaceName}");

            var webResponse = await this.RestClientAsync.Post(uri, request.UpdateNamespaceMetadataDetails, new HttpRequestHeaderParam()
            {
                OpcClientRequestId = request.OpcClientRequestId
            });

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

                    return(new UpdateNamespaceMetadataResponse()
                    {
                        NamespaceMetadata = JsonSerializer.Deserialize <NamespaceMetadata>(response),
                        OpcRequestId = webResponse.Headers.Get("opc-request-id"),
                        OpcClientRequestId = webResponse.Headers.Get("opc-client-request-id")
                    });
                }
        }
Example #2
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            UpdateNamespaceMetadataRequest request;

            try
            {
                request = new UpdateNamespaceMetadataRequest
                {
                    NamespaceName = NamespaceName,
                    UpdateNamespaceMetadataDetails = UpdateNamespaceMetadataDetails,
                    OpcClientRequestId             = OpcClientRequestId
                };

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