Delete hosted zone resource record set with PHP on amazon












0















I can't figure out how to delete hosted zone resource record set with Amazon PHP sdk.



So my code is following



public function __construct(ConsoleOutput $stdout = null, ConsoleOutput $stderr = null, ConsoleInput $stdin = null) {
parent::__construct($stdout, $stderr, $stdin);

/** @var AwsRoute53Route53Client route53Client */
$this->route53Client = Route53Client::factory([
'version' => '2013-04-01',
'region' => 'eu-west-1',
'credentials' => [
'key' => <my-key>,
'secret' => <my-secret-key>
]
]);
}


And this is my function for deleting resource record set



private function deleteResourceRecordSet() {

$response = $this->route53Client->changeResourceRecordSets([
'ChangeBatch' => [
'Changes' => [
[
'Action' => 'DELETE',
'ResourceRecordSet' => [
'Name' => 'pm-bounces.subdomain.myDomain.com.',
'Region' => 'eu-west-1',
'Type' => 'CNAME',
],
]
]
],
'HostedZoneId' => '/hostedzone/<myHostedZoneId>'
]);
var_dump($response);
die();
}


And the error I'm keep getting is



Error executing "ChangeResourceRecordSets" on "https://route53.amazonaws.com/2013-04-01/hostedzone/<myHostedZoneId>/rrset/"; AWS HTTP error: Client error: `POST https://route53.amazonaws.com/2013-04-01/hostedzone/<myHostedZoneId>/rrset/` resulted in a `400 Bad Request` response:
<?xml version="1.0"?>
<ErrorResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/"><Error><Type>Sender</Type><Co (truncated...)
InvalidInput (client): Invalid request: Expected exactly one of [AliasTarget, all of [TTL, and ResourceRecords], or TrafficPolicyInstanceId], but found none in Change with [Action=DELETE, Name=pm-bounces.subdomain.myDomain.com., Type=CNAME, SetIdentifier=null] - <?xml version="1.0"?>
<ErrorResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/"><Error><Type>Sender</Type><Code>InvalidInput</Code><Message>Invalid request: Expected exactly one of [AliasTarget, all of [TTL, and ResourceRecords], or TrafficPolicyInstanceId], but found none in Change with [Action=DELETE, Name=pm-bounces.subdomain.myDomain.com., Type=CNAME, SetIdentifier=null]</Message>


So what exactly is minimum required set of params so I will be available to delete resource record from hosted zone? If you need any additional informations, please let me know and I will provide. Thank you










share|improve this question



























    0















    I can't figure out how to delete hosted zone resource record set with Amazon PHP sdk.



    So my code is following



    public function __construct(ConsoleOutput $stdout = null, ConsoleOutput $stderr = null, ConsoleInput $stdin = null) {
    parent::__construct($stdout, $stderr, $stdin);

    /** @var AwsRoute53Route53Client route53Client */
    $this->route53Client = Route53Client::factory([
    'version' => '2013-04-01',
    'region' => 'eu-west-1',
    'credentials' => [
    'key' => <my-key>,
    'secret' => <my-secret-key>
    ]
    ]);
    }


    And this is my function for deleting resource record set



    private function deleteResourceRecordSet() {

    $response = $this->route53Client->changeResourceRecordSets([
    'ChangeBatch' => [
    'Changes' => [
    [
    'Action' => 'DELETE',
    'ResourceRecordSet' => [
    'Name' => 'pm-bounces.subdomain.myDomain.com.',
    'Region' => 'eu-west-1',
    'Type' => 'CNAME',
    ],
    ]
    ]
    ],
    'HostedZoneId' => '/hostedzone/<myHostedZoneId>'
    ]);
    var_dump($response);
    die();
    }


    And the error I'm keep getting is



    Error executing "ChangeResourceRecordSets" on "https://route53.amazonaws.com/2013-04-01/hostedzone/<myHostedZoneId>/rrset/"; AWS HTTP error: Client error: `POST https://route53.amazonaws.com/2013-04-01/hostedzone/<myHostedZoneId>/rrset/` resulted in a `400 Bad Request` response:
    <?xml version="1.0"?>
    <ErrorResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/"><Error><Type>Sender</Type><Co (truncated...)
    InvalidInput (client): Invalid request: Expected exactly one of [AliasTarget, all of [TTL, and ResourceRecords], or TrafficPolicyInstanceId], but found none in Change with [Action=DELETE, Name=pm-bounces.subdomain.myDomain.com., Type=CNAME, SetIdentifier=null] - <?xml version="1.0"?>
    <ErrorResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/"><Error><Type>Sender</Type><Code>InvalidInput</Code><Message>Invalid request: Expected exactly one of [AliasTarget, all of [TTL, and ResourceRecords], or TrafficPolicyInstanceId], but found none in Change with [Action=DELETE, Name=pm-bounces.subdomain.myDomain.com., Type=CNAME, SetIdentifier=null]</Message>


    So what exactly is minimum required set of params so I will be available to delete resource record from hosted zone? If you need any additional informations, please let me know and I will provide. Thank you










    share|improve this question

























      0












      0








      0








      I can't figure out how to delete hosted zone resource record set with Amazon PHP sdk.



      So my code is following



      public function __construct(ConsoleOutput $stdout = null, ConsoleOutput $stderr = null, ConsoleInput $stdin = null) {
      parent::__construct($stdout, $stderr, $stdin);

      /** @var AwsRoute53Route53Client route53Client */
      $this->route53Client = Route53Client::factory([
      'version' => '2013-04-01',
      'region' => 'eu-west-1',
      'credentials' => [
      'key' => <my-key>,
      'secret' => <my-secret-key>
      ]
      ]);
      }


      And this is my function for deleting resource record set



      private function deleteResourceRecordSet() {

      $response = $this->route53Client->changeResourceRecordSets([
      'ChangeBatch' => [
      'Changes' => [
      [
      'Action' => 'DELETE',
      'ResourceRecordSet' => [
      'Name' => 'pm-bounces.subdomain.myDomain.com.',
      'Region' => 'eu-west-1',
      'Type' => 'CNAME',
      ],
      ]
      ]
      ],
      'HostedZoneId' => '/hostedzone/<myHostedZoneId>'
      ]);
      var_dump($response);
      die();
      }


      And the error I'm keep getting is



      Error executing "ChangeResourceRecordSets" on "https://route53.amazonaws.com/2013-04-01/hostedzone/<myHostedZoneId>/rrset/"; AWS HTTP error: Client error: `POST https://route53.amazonaws.com/2013-04-01/hostedzone/<myHostedZoneId>/rrset/` resulted in a `400 Bad Request` response:
      <?xml version="1.0"?>
      <ErrorResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/"><Error><Type>Sender</Type><Co (truncated...)
      InvalidInput (client): Invalid request: Expected exactly one of [AliasTarget, all of [TTL, and ResourceRecords], or TrafficPolicyInstanceId], but found none in Change with [Action=DELETE, Name=pm-bounces.subdomain.myDomain.com., Type=CNAME, SetIdentifier=null] - <?xml version="1.0"?>
      <ErrorResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/"><Error><Type>Sender</Type><Code>InvalidInput</Code><Message>Invalid request: Expected exactly one of [AliasTarget, all of [TTL, and ResourceRecords], or TrafficPolicyInstanceId], but found none in Change with [Action=DELETE, Name=pm-bounces.subdomain.myDomain.com., Type=CNAME, SetIdentifier=null]</Message>


      So what exactly is minimum required set of params so I will be available to delete resource record from hosted zone? If you need any additional informations, please let me know and I will provide. Thank you










      share|improve this question














      I can't figure out how to delete hosted zone resource record set with Amazon PHP sdk.



      So my code is following



      public function __construct(ConsoleOutput $stdout = null, ConsoleOutput $stderr = null, ConsoleInput $stdin = null) {
      parent::__construct($stdout, $stderr, $stdin);

      /** @var AwsRoute53Route53Client route53Client */
      $this->route53Client = Route53Client::factory([
      'version' => '2013-04-01',
      'region' => 'eu-west-1',
      'credentials' => [
      'key' => <my-key>,
      'secret' => <my-secret-key>
      ]
      ]);
      }


      And this is my function for deleting resource record set



      private function deleteResourceRecordSet() {

      $response = $this->route53Client->changeResourceRecordSets([
      'ChangeBatch' => [
      'Changes' => [
      [
      'Action' => 'DELETE',
      'ResourceRecordSet' => [
      'Name' => 'pm-bounces.subdomain.myDomain.com.',
      'Region' => 'eu-west-1',
      'Type' => 'CNAME',
      ],
      ]
      ]
      ],
      'HostedZoneId' => '/hostedzone/<myHostedZoneId>'
      ]);
      var_dump($response);
      die();
      }


      And the error I'm keep getting is



      Error executing "ChangeResourceRecordSets" on "https://route53.amazonaws.com/2013-04-01/hostedzone/<myHostedZoneId>/rrset/"; AWS HTTP error: Client error: `POST https://route53.amazonaws.com/2013-04-01/hostedzone/<myHostedZoneId>/rrset/` resulted in a `400 Bad Request` response:
      <?xml version="1.0"?>
      <ErrorResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/"><Error><Type>Sender</Type><Co (truncated...)
      InvalidInput (client): Invalid request: Expected exactly one of [AliasTarget, all of [TTL, and ResourceRecords], or TrafficPolicyInstanceId], but found none in Change with [Action=DELETE, Name=pm-bounces.subdomain.myDomain.com., Type=CNAME, SetIdentifier=null] - <?xml version="1.0"?>
      <ErrorResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/"><Error><Type>Sender</Type><Code>InvalidInput</Code><Message>Invalid request: Expected exactly one of [AliasTarget, all of [TTL, and ResourceRecords], or TrafficPolicyInstanceId], but found none in Change with [Action=DELETE, Name=pm-bounces.subdomain.myDomain.com., Type=CNAME, SetIdentifier=null]</Message>


      So what exactly is minimum required set of params so I will be available to delete resource record from hosted zone? If you need any additional informations, please let me know and I will provide. Thank you







      php aws-sdk aws-php-sdk






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 days ago









      Valor_Valor_

      1,06332257




      1,06332257
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Ok I have figure it out. If you wan't to delete resource record set from hosted zones, then the code/function for deleting record set should look like following



          private function deleteResourceRecordSet($zoneId, $name, $ResourceRecordsValue, $recordType, $ttl) {

          $response = $this->route53Client->changeResourceRecordSets([
          'ChangeBatch' => [
          'Changes' => [
          [
          'Action' => 'DELETE',
          "ResourceRecordSet" => [
          'Name' => $name,
          'Type' => $recordType,
          'TTL' => $ttl,
          'ResourceRecords' => [
          $ResourceRecordsValue // should be reference array of all resource records set
          ]
          ]
          ]
          ]
          ],
          'HostedZoneId' => $zoneId
          ]);
          }





          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54252820%2fdelete-hosted-zone-resource-record-set-with-php-on-amazon%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Ok I have figure it out. If you wan't to delete resource record set from hosted zones, then the code/function for deleting record set should look like following



            private function deleteResourceRecordSet($zoneId, $name, $ResourceRecordsValue, $recordType, $ttl) {

            $response = $this->route53Client->changeResourceRecordSets([
            'ChangeBatch' => [
            'Changes' => [
            [
            'Action' => 'DELETE',
            "ResourceRecordSet" => [
            'Name' => $name,
            'Type' => $recordType,
            'TTL' => $ttl,
            'ResourceRecords' => [
            $ResourceRecordsValue // should be reference array of all resource records set
            ]
            ]
            ]
            ]
            ],
            'HostedZoneId' => $zoneId
            ]);
            }





            share|improve this answer




























              0














              Ok I have figure it out. If you wan't to delete resource record set from hosted zones, then the code/function for deleting record set should look like following



              private function deleteResourceRecordSet($zoneId, $name, $ResourceRecordsValue, $recordType, $ttl) {

              $response = $this->route53Client->changeResourceRecordSets([
              'ChangeBatch' => [
              'Changes' => [
              [
              'Action' => 'DELETE',
              "ResourceRecordSet" => [
              'Name' => $name,
              'Type' => $recordType,
              'TTL' => $ttl,
              'ResourceRecords' => [
              $ResourceRecordsValue // should be reference array of all resource records set
              ]
              ]
              ]
              ]
              ],
              'HostedZoneId' => $zoneId
              ]);
              }





              share|improve this answer


























                0












                0








                0







                Ok I have figure it out. If you wan't to delete resource record set from hosted zones, then the code/function for deleting record set should look like following



                private function deleteResourceRecordSet($zoneId, $name, $ResourceRecordsValue, $recordType, $ttl) {

                $response = $this->route53Client->changeResourceRecordSets([
                'ChangeBatch' => [
                'Changes' => [
                [
                'Action' => 'DELETE',
                "ResourceRecordSet" => [
                'Name' => $name,
                'Type' => $recordType,
                'TTL' => $ttl,
                'ResourceRecords' => [
                $ResourceRecordsValue // should be reference array of all resource records set
                ]
                ]
                ]
                ]
                ],
                'HostedZoneId' => $zoneId
                ]);
                }





                share|improve this answer













                Ok I have figure it out. If you wan't to delete resource record set from hosted zones, then the code/function for deleting record set should look like following



                private function deleteResourceRecordSet($zoneId, $name, $ResourceRecordsValue, $recordType, $ttl) {

                $response = $this->route53Client->changeResourceRecordSets([
                'ChangeBatch' => [
                'Changes' => [
                [
                'Action' => 'DELETE',
                "ResourceRecordSet" => [
                'Name' => $name,
                'Type' => $recordType,
                'TTL' => $ttl,
                'ResourceRecords' => [
                $ResourceRecordsValue // should be reference array of all resource records set
                ]
                ]
                ]
                ]
                ],
                'HostedZoneId' => $zoneId
                ]);
                }






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 2 days ago









                Valor_Valor_

                1,06332257




                1,06332257






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54252820%2fdelete-hosted-zone-resource-record-set-with-php-on-amazon%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Homophylophilia

                    Updating UILabel text programmatically using a function

                    Cloud Functions - OpenCV Videocapture Read method fails for larger files from cloud storage