コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="hostname">Fully qualified host name, i.e. host.domain.com</param>
        /// <param name="ipAddress">The IP Address to update to.</param>
        public override bool UpdateHostname(string hostname, string ipAddress)
        {
            if (HasIpAddresssChanged(hostname, ipAddress) == false)
            {
                return(true);                                                                // No change, no need to update
            }
            if (IsValidIpAddress(ipAddress) == false)
            {
                logger.Error(string.Format("Invalid IP Address provided: {0}", ipAddress));
                return(false);
            }

            var zones = GetHostedZones();

            if (zones == null)
            {
                return(false);
            }

            try
            {
                if (!LastUpdateIpAddresses.ContainsKey(hostname))
                {
                    InitializeLastUpdateIpAddresses(hostname);
                }

                var lastIpAddress = LastUpdateIpAddresses[hostname];

                var deleteRequest  = GetChangeResourceRecordSetsRequest(hostname, lastIpAddress, EnumerationUtility.GetStringValue(ChangeActionType.Delete), zones);
                var deleteResponse = client.ChangeResourceRecordSets(deleteRequest);
            }
            //Ignore, if delete fails, its probably because the record didn't already exists
            catch (AmazonRoute53Exception ex)
            {
                logger.Warn(ex);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }

            try
            {
                var createRequest  = GetChangeResourceRecordSetsRequest(hostname, ipAddress, EnumerationUtility.GetStringValue(ChangeActionType.Create), zones);
                var createResponse = client.ChangeResourceRecordSets(createRequest);

                //ChangeInfo info: http://docs.amazonwebservices.com/sdkfornet/latest/apidocs/?topic=html/T_Amazon_Route53_Model_ChangeInfo.htm
                //response.ChangeResourceRecordSetsResult.ChangeInfo.Status

                LastUpdateIpAddresses[hostname] = ipAddress;
                return(true);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                return(false);
            }
        }
コード例 #2
0
        public ChangeResourceRecordSetsResponse updateRRSet(
            string hostedZoneId, ResourceRecordSet oldRRset, ResourceRecordSet newRRset)
        {
            logger.Info("Calling ChangeResourceRecordSets");
            Change delete = new Change()
            {
                Action            = Action.DELETE.ToString(),
                ResourceRecordSet = oldRRset
            };
            Change create = new Change()
            {
                Action            = Action.CREATE.ToString(),
                ResourceRecordSet = newRRset
            };
            List <Change> changes = new List <Change>()
            {
                delete, create
            };

            ChangeBatch batch = new ChangeBatch()
            {
                Changes = changes
            };

            return(client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest()
            {
                HostedZoneId = hostedZoneId,
                ChangeBatch = batch
            }));
        }
コード例 #3
0
        public void Route53ChangeResourceRecordSets()
        {
            #region to-create-update-or-delete-resource-record-sets-1484344703668

            var client   = new AmazonRoute53Client();
            var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest
            {
                ChangeBatch = new ChangeBatch {
                    Changes = new List <Change> {
                        new Change {
                            Action            = "CREATE",
                            ResourceRecordSet = new ResourceRecordSet {
                                Name            = "example.com",
                                ResourceRecords = new List <ResourceRecord> {
                                    new ResourceRecord {
                                        Value = "192.0.2.44"
                                    }
                                },
                                TTL  = 60,
                                Type = "A"
                            }
                        }
                    },
                    Comment = "Web server for example.com"
                },
                HostedZoneId = "Z3M3LMPEXAMPLE"
            });

            ChangeInfo changeInfo = response.ChangeInfo;

            #endregion
        }
コード例 #4
0
        public void Route53ChangeResourceRecordSets()
        {
            #region to-create-an-alias-resource-record-set-1484348404062

            var client   = new AmazonRoute53Client();
            var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest
            {
                ChangeBatch = new ChangeBatch {
                    Changes = new List <Change> {
                        new Change {
                            Action            = "CREATE",
                            ResourceRecordSet = new ResourceRecordSet {
                                AliasTarget = new AliasTarget {
                                    DNSName = "d123rk29d0stfj.cloudfront.net",
                                    EvaluateTargetHealth = false,
                                    HostedZoneId         = "Z2FDTNDATAQYW2"
                                },
                                Name = "example.com",
                                Type = "A"
                            }
                        }
                    },
                    Comment = "CloudFront distribution for example.com"
                },
                HostedZoneId = "Z3M3LMPEXAMPLE" // Depends on the type of resource that you want to route traffic to
            });

            ChangeInfo changeInfo = response.ChangeInfo;

            #endregion
        }
コード例 #5
0
        private bool ApplyDnsChange(HostedZone zone, ResourceRecordSet recordSet, ChangeAction action)
        {
            // Prepare change as Batch
            Change changeDetails = new Change()
            {
                ResourceRecordSet = recordSet,
                Action            = action
            };

            ChangeBatch changeBatch = new ChangeBatch()
            {
                Changes = new List <Change> {
                    changeDetails
                }
            };

            // Prepare zone's resource record sets
            var recordsetRequest = new ChangeResourceRecordSetsRequest()
            {
                HostedZoneId = zone.Id,
                ChangeBatch  = changeBatch
            };

            logger.Debug($"Route53 :: ApplyDnsChange : ChangeResourceRecordSets: {recordsetRequest.ChangeBatch} ");

            var recordsetResponse = route53Client.ChangeResourceRecordSets(recordsetRequest);

            logger.Debug($"Route53 :: ApplyDnsChange : ChangeResourceRecordSets Response: {recordsetResponse} ");

            logger.Info("DNS change completed.");

            return(true);
        }
コード例 #6
0
        public override void CreateRecord(string recordName, string token)
        {
            var hostedZoneId = GetHostedZoneId(recordName);

            if (hostedZoneId == null)
            {
                return;
            }

            _log.Information($"Creating TXT record {recordName} with value {token}");

            var response = _route53Client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest(hostedZoneId,
                                                                                                       new ChangeBatch(new List <Change> {
                new Change(ChangeAction.UPSERT, CreateResourceRecordSet(recordName, token))
            })));

            WaitChangesPropagation(response.ChangeInfo);
        }
コード例 #7
0
        public void Route53ChangeResourceRecordSets()
        {
            #region to-create-weighted-resource-record-sets-1484348208522

            var client   = new AmazonRoute53Client();
            var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest
            {
                ChangeBatch = new ChangeBatch {
                    Changes = new List <Change> {
                        new Change {
                            Action            = "CREATE",
                            ResourceRecordSet = new ResourceRecordSet {
                                HealthCheckId   = "abcdef11-2222-3333-4444-555555fedcba",
                                Name            = "example.com",
                                ResourceRecords = new List <ResourceRecord> {
                                    new ResourceRecord {
                                        Value = "192.0.2.44"
                                    }
                                },
                                SetIdentifier = "Seattle data center",
                                TTL           = 60,
                                Type          = "A",
                                Weight        = 100
                            }
                        },
                        new Change {
                            Action            = "CREATE",
                            ResourceRecordSet = new ResourceRecordSet {
                                HealthCheckId   = "abcdef66-7777-8888-9999-000000fedcba",
                                Name            = "example.com",
                                ResourceRecords = new List <ResourceRecord> {
                                    new ResourceRecord {
                                        Value = "192.0.2.45"
                                    }
                                },
                                SetIdentifier = "Portland data center",
                                TTL           = 60,
                                Type          = "A",
                                Weight        = 200
                            }
                        }
                    },
                    Comment = "Web servers for example.com"
                },
                HostedZoneId = "Z3M3LMPEXAMPLE"
            });

            ChangeInfo changeInfo = response.ChangeInfo;

            #endregion
        }
コード例 #8
0
        public void Route53ChangeResourceRecordSets()
        {
            #region to-create-failover-resource-record-sets-1484604541740

            var client   = new AmazonRoute53Client();
            var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest
            {
                ChangeBatch = new ChangeBatch {
                    Changes = new List <Change> {
                        new Change {
                            Action            = "CREATE",
                            ResourceRecordSet = new ResourceRecordSet {
                                Failover        = "PRIMARY",
                                HealthCheckId   = "abcdef11-2222-3333-4444-555555fedcba",
                                Name            = "example.com",
                                ResourceRecords = new List <ResourceRecord> {
                                    new ResourceRecord {
                                        Value = "192.0.2.44"
                                    }
                                },
                                SetIdentifier = "Ohio region",
                                TTL           = 60,
                                Type          = "A"
                            }
                        },
                        new Change {
                            Action            = "CREATE",
                            ResourceRecordSet = new ResourceRecordSet {
                                Failover        = "SECONDARY",
                                HealthCheckId   = "abcdef66-7777-8888-9999-000000fedcba",
                                Name            = "example.com",
                                ResourceRecords = new List <ResourceRecord> {
                                    new ResourceRecord {
                                        Value = "192.0.2.45"
                                    }
                                },
                                SetIdentifier = "Oregon region",
                                TTL           = 60,
                                Type          = "A"
                            }
                        }
                    },
                    Comment = "Failover configuration for example.com"
                },
                HostedZoneId = "Z3M3LMPEXAMPLE"
            });

            ChangeInfo changeInfo = response.ChangeInfo;

            #endregion
        }
コード例 #9
0
        public void Route53ChangeResourceRecordSets()
        {
            #region to-create-latency-resource-record-sets-1484350219917

            var client   = new AmazonRoute53Client();
            var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest
            {
                ChangeBatch = new ChangeBatch {
                    Changes = new List <Change> {
                        new Change {
                            Action            = "CREATE",
                            ResourceRecordSet = new ResourceRecordSet {
                                HealthCheckId   = "abcdef11-2222-3333-4444-555555fedcba",
                                Name            = "example.com",
                                Region          = "us-east-2",
                                ResourceRecords = new List <ResourceRecord> {
                                    new ResourceRecord {
                                        Value = "192.0.2.44"
                                    }
                                },
                                SetIdentifier = "Ohio region",
                                TTL           = 60,
                                Type          = "A"
                            }
                        },
                        new Change {
                            Action            = "CREATE",
                            ResourceRecordSet = new ResourceRecordSet {
                                HealthCheckId   = "abcdef66-7777-8888-9999-000000fedcba",
                                Name            = "example.com",
                                Region          = "us-west-2",
                                ResourceRecords = new List <ResourceRecord> {
                                    new ResourceRecord {
                                        Value = "192.0.2.45"
                                    }
                                },
                                SetIdentifier = "Oregon region",
                                TTL           = 60,
                                Type          = "A"
                            }
                        }
                    },
                    Comment = "EC2 instances for example.com"
                },
                HostedZoneId = "Z3M3LMPEXAMPLE"
            });

            ChangeInfo changeInfo = response.ChangeInfo;

            #endregion
        }
コード例 #10
0
        public ChangeResourceRecordSetsResponse updateRRSet(string hostedZoneId, ResourceRecordSet oldRRset, ResourceRecordSet newRRset)
        {
            logger.Info("Calling ChangeResourceRecordSets");
            List <Change> changes = new List <Change>()
            {
                new Change().WithAction(Action.DELETE.ToString()).WithResourceRecordSet(oldRRset),
                new Change().WithAction(Action.CREATE.ToString()).WithResourceRecordSet(newRRset)
            };

            ChangeBatch batch = new ChangeBatch().WithChanges(changes.ToArray());

            return(client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest()
                                                   .WithHostedZoneId(hostedZoneId)
                                                   .WithChangeBatch(batch)));
        }
コード例 #11
0
        public void Route53ChangeResourceRecordSets()
        {
            #region to-create-failover-alias-resource-record-sets-1484607497724

            var client   = new AmazonRoute53Client();
            var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest
            {
                ChangeBatch = new ChangeBatch {
                    Changes = new List <Change> {
                        new Change {
                            Action            = "CREATE",
                            ResourceRecordSet = new ResourceRecordSet {
                                AliasTarget = new AliasTarget {
                                    DNSName = "example-com-123456789.us-east-2.elb.amazonaws.com ",
                                    EvaluateTargetHealth = true,
                                    HostedZoneId         = "Z3AADJGX6KTTL2"
                                },
                                Failover      = "PRIMARY",
                                Name          = "example.com",
                                SetIdentifier = "Ohio region",
                                Type          = "A"
                            }
                        },
                        new Change {
                            Action            = "CREATE",
                            ResourceRecordSet = new ResourceRecordSet {
                                AliasTarget = new AliasTarget {
                                    DNSName = "example-com-987654321.us-west-2.elb.amazonaws.com ",
                                    EvaluateTargetHealth = true,
                                    HostedZoneId         = "Z1H1FL5HABSF5"
                                },
                                Failover      = "SECONDARY",
                                Name          = "example.com",
                                SetIdentifier = "Oregon region",
                                Type          = "A"
                            }
                        }
                    },
                    Comment = "Failover alias configuration for example.com"
                },
                HostedZoneId = "Z3M3LMPEXAMPLE" // Depends on the type of resource that you want to route traffic to
            });

            ChangeInfo changeInfo = response.ChangeInfo;

            #endregion
        }
コード例 #12
0
        public static void UpdateRoute53Record(string hostname, IPAddress newIp)
        {
            var route53Client = new AmazonRoute53Client(
                Settings.AwsAccessKeyId,
                Settings.AwsSecretAccessKey,
                Amazon.RegionEndpoint.USEast1);

            var recordSet = new ResourceRecordSet
            {
                Name            = hostname,
                TTL             = 60,
                Type            = RRType.A,
                ResourceRecords = new List <ResourceRecord>
                {
                    new ResourceRecord {
                        Value = newIp.ToString()
                    }
                }
            };

            var changeBatch = new ChangeBatch
            {
                Changes = new List <Change>
                {
                    new Change
                    {
                        ResourceRecordSet = recordSet,
                        Action            = ChangeAction.UPSERT
                    }
                }
            };

            var recordsetRequest = new ChangeResourceRecordSetsRequest
            {
                HostedZoneId = Settings.HostedZoneId,
                ChangeBatch  = changeBatch
            };

            route53Client.ChangeResourceRecordSets(recordsetRequest);
        }
コード例 #13
0
        //https://docs.aws.amazon.com/sdk-for-net/v2/developer-guide/route53-apis-intro.html
        public static void UpdateRecord()
        {
            //TODO: Better exception handling overall in the method
            SimpleLogging.WriteToLog("Time to check for update to public IP", true);
            SimpleLogging.WriteToLog("Last public IP was " + lastIP, true);
            string publicIP = GetPublicIP(ServiceConfig.GetPublicIPTries);

            SimpleLogging.WriteToLog("Current public IP is " + publicIP, true);

            if (publicIP == "")
            {
                SimpleLogging.WriteToLog("Failed to check for new public IP");
                return;
            }

            if (publicIP == lastIP)
            {
                if (ServiceConfig.WriteLogsOnlyIfIPChanged)
                {
                    SimpleLogging.WipePendingLogData();
                }
                else
                {
                    SimpleLogging.WriteToLog("Public IP address has not changed" + Environment.NewLine);
                }
                return;
            }
            SimpleLogging.WriteToLog("Contacting AWS to update public IP");
            lastIP = publicIP;

            //TODO: Better exception handling when these values aren't working
            //TODO: Confirm all users can use the APSoutheast2 endpoint
            var route53Client = new AmazonRoute53Client(ServiceConfig.AwsAccessKeyId, ServiceConfig.AwsSecretAccessKey, RegionEndpoint.APSoutheast2);

            SimpleLogging.WriteToLog("Successfully authenticated to AWS");

            var recordSet = new ResourceRecordSet()
            {
                Name            = ServiceConfig.DomainName,
                TTL             = 60,
                Type            = RRType.A, //TODO: Update so can do IPv6 records also where required
                ResourceRecords = new List <ResourceRecord>
                {
                    new ResourceRecord {
                        Value = publicIP
                    }
                }
            };

            var changeBatch = new ChangeBatch()
            {
                Changes = new List <Change>
                {
                    new Change()
                    {
                        ResourceRecordSet = recordSet,
                        Action            = ChangeAction.UPSERT
                    }
                }
            };

            var recordsetRequest = new ChangeResourceRecordSetsRequest()
            {
                HostedZoneId = ServiceConfig.HostedZoneId,
                ChangeBatch  = changeBatch
            };

            var recordsetResponse = route53Client.ChangeResourceRecordSets(recordsetRequest);

            SimpleLogging.WriteToLog("Succesfully submitted update request to AWS");

            var changeRequest = new GetChangeRequest()
            {
                Id = recordsetResponse.ChangeInfo.Id
            };

            while (ChangeStatus.PENDING == route53Client.GetChange(changeRequest).ChangeInfo.Status)
            {
                SimpleLogging.WriteToLog("Waiting for change to be INSYNC");
                Thread.Sleep(ServiceConfig.AWSGetChangeSleepTime);
            }

            SimpleLogging.WriteToLog("Succesfully updated IP address to " + publicIP + Environment.NewLine);
        }
コード例 #14
0
        public void Route53ChangeResourceRecordSets()
        {
            #region to-create-geolocation-alias-resource-record-sets-1484612871203

            var client   = new AmazonRoute53Client();
            var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest
            {
                ChangeBatch = new ChangeBatch {
                    Changes = new List <Change> {
                        new Change {
                            Action            = "CREATE",
                            ResourceRecordSet = new ResourceRecordSet {
                                AliasTarget = new AliasTarget {
                                    DNSName = "example-com-123456789.us-east-2.elb.amazonaws.com ",
                                    EvaluateTargetHealth = true,
                                    HostedZoneId         = "Z3AADJGX6KTTL2"
                                },
                                GeoLocation = new GeoLocation {
                                    ContinentCode = "NA"
                                },
                                Name          = "example.com",
                                SetIdentifier = "North America",
                                Type          = "A"
                            }
                        },
                        new Change {
                            Action            = "CREATE",
                            ResourceRecordSet = new ResourceRecordSet {
                                AliasTarget = new AliasTarget {
                                    DNSName = "example-com-234567890.sa-east-1.elb.amazonaws.com ",
                                    EvaluateTargetHealth = true,
                                    HostedZoneId         = "Z2P70J7HTTTPLU"
                                },
                                GeoLocation = new GeoLocation {
                                    ContinentCode = "SA"
                                },
                                Name          = "example.com",
                                SetIdentifier = "South America",
                                Type          = "A"
                            }
                        },
                        new Change {
                            Action            = "CREATE",
                            ResourceRecordSet = new ResourceRecordSet {
                                AliasTarget = new AliasTarget {
                                    DNSName = "example-com-234567890.eu-central-1.elb.amazonaws.com ",
                                    EvaluateTargetHealth = true,
                                    HostedZoneId         = "Z215JYRZR1TBD5"
                                },
                                GeoLocation = new GeoLocation {
                                    ContinentCode = "EU"
                                },
                                Name          = "example.com",
                                SetIdentifier = "Europe",
                                Type          = "A"
                            }
                        },
                        new Change {
                            Action            = "CREATE",
                            ResourceRecordSet = new ResourceRecordSet {
                                AliasTarget = new AliasTarget {
                                    DNSName = "example-com-234567890.ap-southeast-1.elb.amazonaws.com ",
                                    EvaluateTargetHealth = true,
                                    HostedZoneId         = "Z1LMS91P8CMLE5"
                                },
                                GeoLocation = new GeoLocation {
                                    CountryCode = "*"
                                },
                                Name          = "example.com",
                                SetIdentifier = "Other locations",
                                Type          = "A"
                            }
                        }
                    },
                    Comment = "Geolocation alias configuration for example.com"
                },
                HostedZoneId = "Z3M3LMPEXAMPLE" // Depends on the type of resource that you want to route traffic to
            });

            ChangeInfo changeInfo = response.ChangeInfo;

            #endregion
        }
コード例 #15
0
        public void Route53ChangeResourceRecordSets()
        {
            #region to-create-geolocation-resource-record-sets-1484612462466

            var client   = new AmazonRoute53Client();
            var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest
            {
                ChangeBatch = new ChangeBatch {
                    Changes = new List <Change> {
                        new Change {
                            Action            = "CREATE",
                            ResourceRecordSet = new ResourceRecordSet {
                                GeoLocation = new GeoLocation {
                                    ContinentCode = "NA"
                                },
                                Name            = "example.com",
                                ResourceRecords = new List <ResourceRecord> {
                                    new ResourceRecord {
                                        Value = "192.0.2.44"
                                    }
                                },
                                SetIdentifier = "North America",
                                TTL           = 60,
                                Type          = "A"
                            }
                        },
                        new Change {
                            Action            = "CREATE",
                            ResourceRecordSet = new ResourceRecordSet {
                                GeoLocation = new GeoLocation {
                                    ContinentCode = "SA"
                                },
                                Name            = "example.com",
                                ResourceRecords = new List <ResourceRecord> {
                                    new ResourceRecord {
                                        Value = "192.0.2.45"
                                    }
                                },
                                SetIdentifier = "South America",
                                TTL           = 60,
                                Type          = "A"
                            }
                        },
                        new Change {
                            Action            = "CREATE",
                            ResourceRecordSet = new ResourceRecordSet {
                                GeoLocation = new GeoLocation {
                                    ContinentCode = "EU"
                                },
                                Name            = "example.com",
                                ResourceRecords = new List <ResourceRecord> {
                                    new ResourceRecord {
                                        Value = "192.0.2.46"
                                    }
                                },
                                SetIdentifier = "Europe",
                                TTL           = 60,
                                Type          = "A"
                            }
                        },
                        new Change {
                            Action            = "CREATE",
                            ResourceRecordSet = new ResourceRecordSet {
                                GeoLocation = new GeoLocation {
                                    CountryCode = "*"
                                },
                                Name            = "example.com",
                                ResourceRecords = new List <ResourceRecord> {
                                    new ResourceRecord {
                                        Value = "192.0.2.47"
                                    }
                                },
                                SetIdentifier = "Other locations",
                                TTL           = 60,
                                Type          = "A"
                            }
                        }
                    },
                    Comment = "Geolocation configuration for example.com"
                },
                HostedZoneId = "Z3M3LMPEXAMPLE"
            });

            ChangeInfo changeInfo = response.ChangeInfo;

            #endregion
        }
コード例 #16
0
ファイル: recordset.cs プロジェクト: philasmar/aws-sdk-net
        public static void Route53CreateAdd(string[] args)
        {
            #region Route53CreateAdd
            string domainName = "www.example.org";

            IAmazonRoute53 route53Client = new AmazonRoute53Client();

            CreateHostedZoneRequest zoneRequest = new CreateHostedZoneRequest
            {
                Name            = domainName,
                CallerReference = "my_change_request"
            };

            CreateHostedZoneResponse zoneResponse = route53Client.CreateHostedZone(zoneRequest);

            ResourceRecordSet recordSet = new ResourceRecordSet
            {
                Name            = domainName,
                TTL             = 60,
                Type            = RRType.A,
                ResourceRecords = new List <ResourceRecord> {
                    new ResourceRecord {
                        Value = "192.0.2.235"
                    }
                }
            };

            Change change1 = new Change
            {
                ResourceRecordSet = recordSet,
                Action            = ChangeAction.CREATE
            };

            ChangeBatch changeBatch = new ChangeBatch
            {
                Changes = new List <Change> {
                    change1
                }
            };

            ChangeResourceRecordSetsRequest recordsetRequest = new ChangeResourceRecordSetsRequest
            {
                HostedZoneId = zoneResponse.HostedZone.Id,
                ChangeBatch  = changeBatch
            };

            ChangeResourceRecordSetsResponse recordsetResponse = route53Client.ChangeResourceRecordSets(recordsetRequest);

            GetChangeRequest changeRequest = new GetChangeRequest
            {
                Id = recordsetResponse.ChangeInfo.Id
            };

            while (route53Client.GetChange(changeRequest).ChangeInfo.Status == ChangeStatus.PENDING)
            {
                Console.WriteLine("Change is pending.");
                Thread.Sleep(TimeSpan.FromSeconds(15));
            }
            #endregion

            Console.WriteLine("Change is complete.");
            Console.ReadKey();
        }