コード例 #1
0
        /// <summary>Snippet for Delete</summary>
        public void DeleteRequestObject()
        {
            // Snippet: Delete(DeleteHealthCheckRequest, CallSettings)
            // Create client
            HealthChecksClient healthChecksClient = HealthChecksClient.Create();
            // Initialize request argument(s)
            DeleteHealthCheckRequest request = new DeleteHealthCheckRequest
            {
                RequestId   = "",
                Project     = "",
                HealthCheck = "",
            };
            // Make the request
            lro::Operation <Operation, Operation> response = healthChecksClient.Delete(request);

            // Poll until the returned long-running operation is complete
            lro::Operation <Operation, Operation> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Operation result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            lro::Operation <Operation, Operation> retrievedResponse = healthChecksClient.PollOnceDelete(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Operation retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
コード例 #2
0
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteHealthCheck operation.
        /// <seealso cref="Amazon.Route53.IAmazonRoute53.DeleteHealthCheck"/>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DeleteHealthCheck operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task <DeleteHealthCheckResponse> DeleteHealthCheckAsync(DeleteHealthCheckRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new DeleteHealthCheckRequestMarshaller();
            var unmarshaller = DeleteHealthCheckResponseUnmarshaller.GetInstance();

            return(Invoke <IRequest, DeleteHealthCheckRequest, DeleteHealthCheckResponse>(request, marshaller, unmarshaller, signer, cancellationToken));
        }
コード例 #3
0
        internal DeleteHealthCheckResponse DeleteHealthCheck(DeleteHealthCheckRequest request)
        {
            var marshaller   = new DeleteHealthCheckRequestMarshaller();
            var unmarshaller = DeleteHealthCheckResponseUnmarshaller.Instance;

            return(Invoke <DeleteHealthCheckRequest, DeleteHealthCheckResponse>(request, marshaller, unmarshaller));
        }
コード例 #4
0
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteHealthCheck operation.
        /// <seealso cref="Amazon.Route53.IAmazonRoute53"/>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DeleteHealthCheck operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task <DeleteHealthCheckResponse> DeleteHealthCheckAsync(DeleteHealthCheckRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new DeleteHealthCheckRequestMarshaller();
            var unmarshaller = DeleteHealthCheckResponseUnmarshaller.Instance;

            return(InvokeAsync <DeleteHealthCheckRequest, DeleteHealthCheckResponse>(request, marshaller,
                                                                                     unmarshaller, cancellationToken));
        }
コード例 #5
0
        /// <summary>
        /// <para>This action deletes a health check. To delete a health check, send a <c>DELETE</c> request to the <c>2013-04-01/healthcheck/health
        /// check ID </c> resource.</para> <para><b>IMPORTANT:</b> You can delete a health check only if there are no resource record sets associated
        /// with this health check. If resource record sets are associated with this health check, you must disassociate them before you can delete your
        /// health check. If you try to delete a health check that is associated with resource record sets, Route 53 will deny your request with a
        /// HealthCheckInUse error. For information about disassociating the records from your health check, see ChangeResourceRecordSets.</para>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DeleteHealthCheck service method on
        /// AmazonRoute53.</param>
        ///
        /// <returns>The response from the DeleteHealthCheck service method, as returned by AmazonRoute53.</returns>
        ///
        /// <exception cref="T:Amazon.Route53.Model.NoSuchHealthCheckException" />
        /// <exception cref="T:Amazon.Route53.Model.HealthCheckInUseException" />
        /// <exception cref="T:Amazon.Route53.Model.InvalidInputException" />
        public DeleteHealthCheckResponse DeleteHealthCheck(DeleteHealthCheckRequest request)
        {
            var task = DeleteHealthCheckAsync(request);

            try
            {
                return(task.Result);
            }
            catch (AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return(null);
            }
        }
コード例 #6
0
 /// <summary>Snippet for Delete</summary>
 public void DeleteRequestObject()
 {
     // Snippet: Delete(DeleteHealthCheckRequest, CallSettings)
     // Create client
     HealthChecksClient healthChecksClient = HealthChecksClient.Create();
     // Initialize request argument(s)
     DeleteHealthCheckRequest request = new DeleteHealthCheckRequest
     {
         RequestId   = "",
         Project     = "",
         HealthCheck = "",
     };
     // Make the request
     Operation response = healthChecksClient.Delete(request);
     // End snippet
 }
コード例 #7
0
        /// <summary>Snippet for DeleteAsync</summary>
        public async Task DeleteRequestObjectAsync()
        {
            // Snippet: DeleteAsync(DeleteHealthCheckRequest, CallSettings)
            // Additional: DeleteAsync(DeleteHealthCheckRequest, CancellationToken)
            // Create client
            HealthChecksClient healthChecksClient = await HealthChecksClient.CreateAsync();

            // Initialize request argument(s)
            DeleteHealthCheckRequest request = new DeleteHealthCheckRequest
            {
                RequestId   = "",
                Project     = "",
                HealthCheck = "",
            };
            // Make the request
            Operation response = await healthChecksClient.DeleteAsync(request);

            // End snippet
        }
コード例 #8
0
 public virtual Task <DeleteHealthCheckResponse> DeleteHealthCheckAsync(DeleteHealthCheckRequest request, CancellationToken cancellationToken = default(CancellationToken))
 {
     throw new NotImplementedException();
 }
コード例 #9
0
ファイル: R53Trigger.cs プロジェクト: zyborg/VMBot
        public async Task HandleTermR53(Instance inst, Dictionary <string, string> tags, string ec2State)
        {
            _logger.LogInformation("Handling REMOVING R53 records");

            var r53Record  = ResolveR53RecordSpec(inst, tags);
            var r53Routing = ResolveR53RoutingSpec(inst, tags);
            var r53Health  = await ResolveR53HealthCheckSpec(inst, tags);

            HealthCheck existingHealth = await FindExistingHealthCheck(r53Health);

            if (r53Record != null)
            {
                var rrset = new ResourceRecordSet
                {
                    Name            = r53Record.Name,
                    Type            = RRType.FindValue(r53Record.Type),
                    TTL             = r53Record.TTL,
                    ResourceRecords = new List <ResourceRecord>
                    {
                        new ResourceRecord(r53Record.Value),
                    },
                };
                // Optional routing policy configuration
                r53Routing?.Apply(rrset);

                if (existingHealth != null)
                {
                    rrset.HealthCheckId = existingHealth.Id;
                }

                var listRequ = new ListResourceRecordSetsRequest
                {
                    HostedZoneId          = r53Record.Zone,
                    StartRecordName       = r53Record.Name,
                    StartRecordType       = r53Record.Type,
                    StartRecordIdentifier = r53Routing?.SetIdentifier,
                };

                var listResp = await _r53.ListResourceRecordSetsAsync(listRequ);

                var rr = listResp.ResourceRecordSets.FirstOrDefault();

                if (rr == null ||
                    rr.Name != r53Record.Name ||
                    rr.Type != r53Record.Type ||
                    (r53Routing != null && !string.Equals(rr.SetIdentifier, r53Routing.SetIdentifier)))
                {
                    _logger.LogWarning("No existing resource records found; SKIPPING");
                    _logger.LogInformation("First returned record for query:");
                    _logger.LogInformation(JsonSerializer.Serialize(rr));
                }
                else
                {
                    var changeRequ = new ChangeResourceRecordSetsRequest
                    {
                        HostedZoneId = r53Record.Zone,
                        ChangeBatch  = new ChangeBatch
                        {
                            Changes = new List <Change>
                            {
                                new Change
                                {
                                    Action            = ChangeAction.DELETE,
                                    ResourceRecordSet = rrset,
                                }
                            }
                        }
                    };

                    var changeResp = await _r53.ChangeResourceRecordSetsAsync(changeRequ);

                    _logger.LogInformation("DELETE request completed, response:");
                    _logger.LogInformation(JsonSerializer.Serialize(changeResp));
                }
            }

            // We delete the Health Check if any, second because
            // the preceding Route policy may depend on it
            if (existingHealth != null &&
                (ec2State == EC2StateChangeStates.ShuttingDown ||
                 ec2State == EC2StateChangeStates.Terminated))
            {
                if (existingHealth != null)
                {
                    _logger.LogInformation($"Found existing Health Check record [{existingHealth.Id}]");
                    var deleteRequ = new DeleteHealthCheckRequest
                    {
                        HealthCheckId = existingHealth.Id,
                    };
                    var deleteResp = await _r53.DeleteHealthCheckAsync(deleteRequ);

                    _logger.LogInformation("DELETE Health Check request completed, response:");
                    _logger.LogInformation(JsonSerializer.Serialize(deleteResp));
                }
            }
        }