Beispiel #1
0
        private void HandleOutput(UpdateDbHomeRequest request)
        {
            var waiterConfig = new WaiterConfiguration
            {
                MaxAttempts           = MaxWaitAttempts,
                GetNextDelayInSeconds = (_) => WaitIntervalSeconds
            };

            switch (ParameterSetName)
            {
            case StatusParamSet:
                response = client.Waiters.ForUpdateDbHome(request, waiterConfig, WaitForStatus).Execute();
                break;

            case Default:
                response = client.UpdateDbHome(request).GetAwaiter().GetResult();
                break;
            }
            WriteOutput(response, response.DbHome);
        }
Beispiel #2
0
        /// <summary>
        /// Patches the specified dbHome.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public UpdateDbHomeResponse UpdateDbHome(UpdateDbHomeRequest request)
        {
            var uri = new Uri($"{GetEndPoint(DatabaseServices.DbHomes, this.Region)}/{request.DbHomeId}");

            using (var webResponse = this.RestClient.Put(uri, request.UpdateDbHomeDetails, new HttpRequestHeaderParam()
            {
                IfMatch = request.IfMatch
            }))
                using (var stream = webResponse.GetResponseStream())
                    using (var reader = new StreamReader(stream))
                    {
                        var response = reader.ReadToEnd();

                        return(new UpdateDbHomeResponse()
                        {
                            DbHome = this.JsonSerializer.Deserialize <DbHomeDetails>(response),
                            OpcRequestId = webResponse.Headers.Get("opc-request-id"),
                            ETag = webResponse.Headers.Get("ETag")
                        });
                    }
        }
Beispiel #3
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            UpdateDbHomeRequest request;

            try
            {
                request = new UpdateDbHomeRequest
                {
                    DbHomeId            = DbHomeId,
                    UpdateDbHomeDetails = UpdateDbHomeDetails,
                    IfMatch             = IfMatch
                };

                HandleOutput(request);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }