Beispiel #1
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ChangeTableCompartmentRequest request;

            try
            {
                request = new ChangeTableCompartmentRequest
                {
                    TableNameOrId = TableNameOrId,
                    ChangeTableCompartmentDetails = ChangeTableCompartmentDetails,
                    OpcRetryToken = OpcRetryToken,
                    IfMatch       = IfMatch,
                    OpcRequestId  = OpcRequestId
                };

                response = client.ChangeTableCompartment(request).GetAwaiter().GetResult();
                WriteOutput(response, CreateWorkRequestObject(response.OpcWorkRequestId));
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Change a table's compartment.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public ChangeTableCompartmentResponse ChangeTableCompartment(ChangeTableCompartmentRequest request)
        {
            var uriStr = $"{GetEndPoint(NoSQLServices.Tables, this.Region)}/{request.TableNameOrId}/actions/changeCompartment";
            var uri    = new Uri(uriStr);

            var httpRequestHeaderParam = new HttpRequestHeaderParam()
            {
                IfMatch       = request.IfMatch,
                OpcRequestId  = request.OpcRequestId,
                OpcRetryToken = request.OpcRetryToken
            };

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

                        return(new ChangeTableCompartmentResponse()
                        {
                            OpcRequestId = webResponse.Headers.Get("opc-request-id"),
                            OpcWorkRequestId = webResponse.Headers.Get("opc-work-request-id")
                        });
                    }
        }