예제 #1
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            UpdateSteeringPolicyAttachmentRequest request;

            try
            {
                request = new UpdateSteeringPolicyAttachmentRequest
                {
                    SteeringPolicyAttachmentId            = SteeringPolicyAttachmentId,
                    UpdateSteeringPolicyAttachmentDetails = UpdateSteeringPolicyAttachmentDetails,
                    IfMatch           = IfMatch,
                    IfUnmodifiedSince = IfUnmodifiedSince,
                    OpcRequestId      = OpcRequestId,
                    Scope             = Scope
                };

                response = client.UpdateSteeringPolicyAttachment(request).GetAwaiter().GetResult();
                WriteOutput(response, response.SteeringPolicyAttachment);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
예제 #2
0
        /// <summary>
        /// Updates the specified steering policy attachment with your new information.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public UpdateSteeringPolicyAttachmentResponse UpdateSteeringPolicyAttachment(UpdateSteeringPolicyAttachmentRequest request)
        {
            var uriStr = $"{GetEndPoint(DNSServices.SteeringPolicyAttachments, this.Region)}/{request.SteeringPolicyAttachmentId}";

            var uri = new Uri(uriStr);

            var httpRequestHeaderParam = new HttpRequestHeaderParam()
            {
                IfMatch           = request.IfMatch,
                IfUnmodifiedSince = request.IfUnmodifiedSince
            };
            var webResponse = this.RestClient.Put(uri, request.UpdateSteeringPolicyAttachmentDetails, httpRequestHeaderParam);

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

                    return(new UpdateSteeringPolicyAttachmentResponse()
                    {
                        SteeringPolicyAttachment = this.JsonSerializer.Deserialize <SteeringPolicyAttachmentDetails>(response),
                        OpcRequestId = webResponse.Headers.Get("opc-request-id"),
                        ETag = webResponse.Headers.Get("ETag")
                    });
                }
        }