A complex type that contains general information about the hosted zone.
        public void TestExecuteWhenNothingToSetAndZoneExists()
        {
            var options = new ChangeResourceRecordSets.Options
                          {
                              Host = "sub.domain.com"
                          };

            var hostedZone = new HostedZone {Id = "AAAAAAAAA1234"};

            route53ServiceMock
                .Setup(call => call.GetZone("domain.com"))
                .Returns(hostedZone);

            route53ServiceMock
                .Setup(call => call.ListResourceRecordSets("AAAAAAAAA1234"))
                .Returns(new List<ResourceRecordSet>());

            var result = command.Execute(options);

            route53ServiceMock
                .Verify(call => call.CreateResourceRecordSet(It.IsAny<string>(), It.IsAny<ResourceRecordSet>()), Times.Never());

            route53ServiceMock
                .Verify(call => call.ReplaceResourceRecordSet(It.IsAny<string>(), It.IsAny<ResourceRecordSet>(), It.IsAny<ResourceRecordSet>()), Times.Never());

            Assert.AreEqual(-1, result);
        }
Пример #2
0
 public IEnumerable<ResourceRecordSet> GetResourceRecordSets(HostedZone zone)
 {
     var request = new ListResourceRecordSetsRequest(zone.Id);
     ListResourceRecordSetsResponse response = _route53Client.ListResourceRecordSets(request);
     return response.ResourceRecordSets;
 }
 public CreateHostedZoneResult WithHostedZone(HostedZone hostedZone)
 {
     this.hostedZone = hostedZone;
     return(this);
 }
        public void TestExecuteWhenSettingLocalIpAddress()
        {
            var options = new ChangeResourceRecordSets.Options
                          {
                              Host = "sub.domain.com",
                              GetLocalIp = true,
                              Ttl = 300
                          };

            var hostedZone = new HostedZone { Id = "AAAAAAAAA1234" };

            route53ServiceMock
                .Setup(call => call.GetZone("domain.com"))
                .Returns(hostedZone);

            var match = new ResourceRecordSet { Name = "sub.domain.com" };

            var records = new List<ResourceRecordSet> { match };

            route53ServiceMock
                .Setup(call => call.ListResourceRecordSets("AAAAAAAAA1234"))
                .Returns(records);

            route53ServiceMock
                .Setup(call => call.GetLocalIpAddress())
                .Returns("172.16.3.3");

            var result = command.Execute(options);

            route53ServiceMock
                .Verify(call => call.ReplaceResourceRecordSet("AAAAAAAAA1234", match, It.IsAny<ResourceRecordSet>()), Times.Once());

            Assert.AreEqual(0, result);
        }
        public void TestExecuteWhenSettingTtlOnlyAndNewRecordWithValue()
        {
            var options = new ChangeResourceRecordSets.Options
                          {
                              Host = "sub.domain.com",
                              IpAddress = "10.1.2.3",
                              Ttl = 300
                          };

            var hostedZone = new HostedZone { Id = "AAAAAAAAA1234" };

            route53ServiceMock
                .Setup(call => call.GetZone("domain.com"))
                .Returns(hostedZone);

            route53ServiceMock
                .Setup(call => call.ListResourceRecordSets("AAAAAAAAA1234"))
                .Returns(new List<ResourceRecordSet>());

            var result = command.Execute(options);

            route53ServiceMock
                .Verify(call => call.CreateResourceRecordSet(It.IsAny<string>(), It.IsAny<ResourceRecordSet>()), Times.Once());

            Assert.AreEqual(0, result);
        }
 /// <summary>
 /// Sets the HostedZone property
 /// </summary>
 /// <param name="hostedZone">The value to set for the HostedZone property </param>
 /// <returns>this instance</returns>
 public GetHostedZoneResult WithHostedZone(HostedZone hostedZone)
 {
     this.hostedZone = hostedZone;
     return this;
 }
Пример #7
0
 public ZAwsHostedZone(ZAwsEc2Controller controller, HostedZone res)
     : base(controller)
 {
     Update(res);
     RecordsAvailable = false;
 }