Exemplo n.º 1
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            if (!ConfirmDelete("OCIDnsSteeringPolicyAttachment", "Remove"))
            {
                return;
            }

            DeleteSteeringPolicyAttachmentRequest request;

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

                response = client.DeleteSteeringPolicyAttachment(request).GetAwaiter().GetResult();
                WriteOutput(response);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Deletes the specified steering policy attachment. A 204 response indicates that the delete has been successful.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public DeleteSteeringPolicyAttachmentResponse DeleteSteeringPolicyAttachment(DeleteSteeringPolicyAttachmentRequest 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.Delete(uri, httpRequestHeaderParam);

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

                    return(new DeleteSteeringPolicyAttachmentResponse()
                    {
                        OpcRequestId = webResponse.Headers.Get("opc-request-id")
                    });
                }
        }