Microsoft.Azure.Commands.Dns.SetAzureDnsZone.ExecuteCmdlet C# (CSharp) Method

ExecuteCmdlet() public method

public ExecuteCmdlet ( ) : void
return void
        public override void ExecuteCmdlet()
        {
            WriteWarning("The output object type of this cmdlet will be modified in a future release.");

            DnsZone result = null;
            DnsZone zoneToUpdate = null;

            if (this.ParameterSetName == "Fields")
            {
                zoneToUpdate = new DnsZone
                {
                    Name = this.Name,
                    ResourceGroupName = this.ResourceGroupName,
                    Etag = "*",
                    Tags = this.Tag,
                };
            }
            else if (this.ParameterSetName == "Object")
            {
                if ((string.IsNullOrWhiteSpace(this.Zone.Etag) || this.Zone.Etag == "*") && !this.Overwrite.IsPresent)
                {
                    throw new PSArgumentException(string.Format(ProjectResources.Error_EtagNotSpecified, typeof(DnsZone).Name));
                }

                zoneToUpdate = this.Zone;
            }

            if (zoneToUpdate.Name != null && zoneToUpdate.Name.EndsWith("."))
            {
                zoneToUpdate.Name = zoneToUpdate.Name.TrimEnd('.');
                this.WriteWarning(string.Format("Modifying zone name to remove terminating '.'.  Zone name used is \"{0}\".", zoneToUpdate.Name));
            }
            ConfirmAction(
                ProjectResources.Progress_Modifying,
                zoneToUpdate.Name,
                () =>
                {
                    bool overwrite = this.Overwrite.IsPresent || this.ParameterSetName != "Object";
                    result = this.DnsClient.UpdateDnsZone(zoneToUpdate, overwrite);

                    WriteVerbose(ProjectResources.Success);
                    WriteObject(result);
                });
        }
    }
SetAzureDnsZone