コード例 #1
0
        /// <summary>
        /// Updates the specified cluster network. The OCID of the cluster network remains the same.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <UpdateClusterNetworkResponse> UpdateClusterNetwork(UpdateClusterNetworkRequest request)
        {
            var uri = new Uri($"{GetEndPoint(CoreServices.ClusterNetworks, this.Region)}/{request.ClusterNetworkId}");

            var headers = new HttpRequestHeaderParam()
            {
                IfMatch       = request.IfMatch,
                OpcRetryToken = request.OpcRetryToken
            };
            var webResponse = await this.RestClientAsync.Put(uri, request.UpdateClusterNetworkDetails, headers);

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

                    return(new UpdateClusterNetworkResponse()
                    {
                        ClusterNetwork = JsonSerializer.Deserialize <ClusterNetwork>(response),
                        OpcRequestId = webResponse.Headers.Get("opc-request-id"),
                        ETag = webResponse.Headers.Get("ETag")
                    });
                }
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            UpdateClusterNetworkRequest request;

            try
            {
                request = new UpdateClusterNetworkRequest
                {
                    ClusterNetworkId            = ClusterNetworkId,
                    UpdateClusterNetworkDetails = UpdateClusterNetworkDetails,
                    OpcRetryToken = OpcRetryToken,
                    IfMatch       = IfMatch
                };

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