From ca954b53ea51f3b95e52fa14e085bbf0d82fe335 Mon Sep 17 00:00:00 2001 From: anuchan Date: Mon, 31 Oct 2016 17:42:34 -0700 Subject: [PATCH 1/7] Fluent models for record set and record sets --- .../azure/management/dns/ARecordSet.java | 91 +++++++++++++ .../azure/management/dns/ARecordSets.java | 7 + .../azure/management/dns/AaaaRecordSet.java | 91 +++++++++++++ .../azure/management/dns/AaaaRecordSets.java | 7 + .../azure/management/dns/CnameRecordSet.java | 91 +++++++++++++ .../azure/management/dns/CnameRecordSets.java | 7 + .../azure/management/dns/DnsRecordSet.java | 22 +++ .../azure/management/dns/DnsZone.java | 128 ++++++++++++++++++ .../azure/management/dns/MxRecordSet.java | 91 +++++++++++++ .../azure/management/dns/MxRecordSets.java | 7 + .../azure/management/dns/NsRecordSet.java | 88 ++++++++++++ .../azure/management/dns/NsRecordSets.java | 7 + .../azure/management/dns/PtrRecordSet.java | 91 +++++++++++++ .../azure/management/dns/PtrRecordSets.java | 7 + .../azure/management/dns/SoaRecordSet.java | 13 ++ .../azure/management/dns/SoaRecordSets.java | 7 + .../azure/management/dns/SrvRecordSet.java | 91 +++++++++++++ .../azure/management/dns/SrvRecordSets.java | 7 + .../azure/management/dns/TxtRecordSet.java | 91 +++++++++++++ .../azure/management/dns/TxtRecordSets.java | 7 + .../dns/implementation/DnsRecordSetImpl.java | 71 ++++++++++ .../dns/implementation/DnsZoneImpl.java | 7 + .../fluentcore/arm/models/HasTags.java | 67 +++++++++ .../fluentcore/arm/models/Resource.java | 47 +------ 24 files changed, 1100 insertions(+), 43 deletions(-) create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/ARecordSet.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/ARecordSets.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSet.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSets.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSet.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSets.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsRecordSet.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsZone.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSet.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSets.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/NsRecordSet.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/NsRecordSets.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/PtrRecordSet.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/PtrRecordSets.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SoaRecordSet.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SoaRecordSets.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SrvRecordSet.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SrvRecordSets.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSet.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSets.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsRecordSetImpl.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsZoneImpl.java create mode 100644 azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/HasTags.java diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/ARecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/ARecordSet.java new file mode 100644 index 0000000000000..f9fe0fb05476b --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/ARecordSet.java @@ -0,0 +1,91 @@ +package com.microsoft.azure.management.dns; + +import com.microsoft.azure.management.resources.fluentcore.arm.models.HasTags; +import com.microsoft.azure.management.resources.fluentcore.model.Appliable; +import com.microsoft.azure.management.resources.fluentcore.model.Creatable; + +import java.util.List; + +/** + * An immutable client-side representation of a A record set in Azure Dns Zone. + */ +public interface ARecordSet extends DnsRecordSet { + /** + * @return the IPv4 addresses of A records in this record set + */ + List ipv4Addresses(); + + /** + * The entirety of the Aaaa record set definition. + */ + interface Definition extends + DefinitionStages.Blank, + DefinitionStages.WithCreate { + } + + /** + * Grouping of A record set definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a A record set definition. + */ + interface Blank { + // TODO + } + + /** + * The stage of the record set definition allowing to specify Ttl for the records in this record set. + */ + interface WithTtl { + /** + * Specifies the Ttl for the records in the record set. + * + * @param ttlInSeconds ttl in seconds + * @return the next stage of the record set definition + */ + WithCreate withTimeToLive(long ttlInSeconds); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends + Creatable, + HasTags.DefinitionWithTags, + DefinitionStages.WithTtl { + } + } + + /** + * Grouping of A record set update stages. + */ + interface UpdateStages { + /** + * The stage of the record set update allowing to specify Ttl for the records in this record set. + */ + interface WithTtl { + /** + * Specifies the Ttl for the records in the record set. + * + * @param ttlInSeconds ttl in seconds + * @return the next stage of the record set update + */ + Update withTimeToLive(long ttlInSeconds); + } + } + + /** + * The template for an update operation, containing all the settings that + * can be modified. + *

+ * Call {@link Update#apply()} to apply the changes to the resource in Azure. + */ + interface Update extends + Appliable, + HasTags.UpdateWithTags, + UpdateStages.WithTtl { + } +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/ARecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/ARecordSets.java new file mode 100644 index 0000000000000..c8e8464637ea7 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/ARecordSets.java @@ -0,0 +1,7 @@ +package com.microsoft.azure.management.dns; + +/** + * Created by anuthomaschandy on 10/31/16. + */ +public interface ARecordSets { +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSet.java new file mode 100644 index 0000000000000..5ed33e7fbc8f1 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSet.java @@ -0,0 +1,91 @@ +package com.microsoft.azure.management.dns; + +import com.microsoft.azure.management.resources.fluentcore.arm.models.HasTags; +import com.microsoft.azure.management.resources.fluentcore.model.Appliable; +import com.microsoft.azure.management.resources.fluentcore.model.Creatable; + +import java.util.List; + +/** + * An immutable client-side representation of a Aaaa record set in Azure Dns Zone. + */ +public interface AaaaRecordSet extends DnsRecordSet { + /** + * @return the IPv6 addresses of Aaaa records in this record set + */ + List ipv6Addresses(); + + /** + * The entirety of the Aaaa record set definition. + */ + interface Definition extends + DefinitionStages.Blank, + DefinitionStages.WithCreate { + } + + /** + * Grouping of Aaaa record set definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Aaaa record set definition. + */ + interface Blank { + // TODO + } + + /** + * The stage of the record set definition allowing to specify Ttl for the records in this record set. + */ + interface WithTtl { + /** + * Specifies the Ttl for the records in the record set. + * + * @param ttlInSeconds ttl in seconds + * @return the next stage of the record set definition + */ + WithCreate withTimeToLive(long ttlInSeconds); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends + Creatable, + HasTags.DefinitionWithTags, + DefinitionStages.WithTtl { + } + } + + /** + * Grouping of Aaaa record set update stages. + */ + interface UpdateStages { + /** + * The stage of the record set update allowing to specify Ttl for the records in this record set. + */ + interface WithTtl { + /** + * Specifies the Ttl for the records in the record set. + * + * @param ttlInSeconds ttl in seconds + * @return the next stage of the record set update + */ + Update withTimeToLive(long ttlInSeconds); + } + } + + /** + * The template for an update operation, containing all the settings that + * can be modified. + *

+ * Call {@link Update#apply()} to apply the changes to the resource in Azure. + */ + interface Update extends + Appliable, + HasTags.UpdateWithTags, + UpdateStages.WithTtl { + } +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSets.java new file mode 100644 index 0000000000000..2b2412f58b0e8 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSets.java @@ -0,0 +1,7 @@ +package com.microsoft.azure.management.dns; + +/** + * Created by anuthomaschandy on 10/31/16. + */ +public interface AaaaRecordSets { +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSet.java new file mode 100644 index 0000000000000..105cab8c72deb --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSet.java @@ -0,0 +1,91 @@ +package com.microsoft.azure.management.dns; + +import com.microsoft.azure.management.resources.fluentcore.arm.models.HasTags; +import com.microsoft.azure.management.resources.fluentcore.model.Appliable; +import com.microsoft.azure.management.resources.fluentcore.model.Creatable; + +import java.util.List; + +/** + * An immutable client-side representation of a CName record set in Azure Dns Zone. + */ +public interface CnameRecordSet extends DnsRecordSet { + /** + * @return the canonical names (without a terminating dot) of CNAME records in this record set + */ + List canonicalNames(); + + /** + * The entirety of the CName record set definition. + */ + interface Definition extends + DefinitionStages.Blank, + DefinitionStages.WithCreate { + } + + /** + * Grouping of CName record set definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a CName record set definition. + */ + interface Blank { + // TODO + } + + /** + * The stage of the record set definition allowing to specify Ttl for the records in this record set. + */ + interface WithTtl { + /** + * Specifies the Ttl for the records in the record set. + * + * @param ttlInSeconds ttl in seconds + * @return the next stage of the record set definition + */ + WithCreate withTimeToLive(long ttlInSeconds); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends + Creatable, + HasTags.DefinitionWithTags, + DefinitionStages.WithTtl { + } + } + + /** + * Grouping of CName record set update stages. + */ + interface UpdateStages { + /** + * The stage of the record set update allowing to specify Ttl for the records in this record set. + */ + interface WithTtl { + /** + * Specifies the Ttl for the records in the record set. + * + * @param ttlInSeconds ttl in seconds + * @return the next stage of the record set update + */ + Update withTimeToLive(long ttlInSeconds); + } + } + + /** + * The template for an update operation, containing all the settings that + * can be modified. + *

+ * Call {@link Update#apply()} to apply the changes to the resource in Azure. + */ + interface Update extends + Appliable, + HasTags.UpdateWithTags, + UpdateStages.WithTtl { + } +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSets.java new file mode 100644 index 0000000000000..a96c0af257bb1 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSets.java @@ -0,0 +1,7 @@ +package com.microsoft.azure.management.dns; + +/** + * Created by anuthomaschandy on 10/31/16. + */ +public interface CnameRecordSets { +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsRecordSet.java new file mode 100644 index 0000000000000..daa2e633b1601 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsRecordSet.java @@ -0,0 +1,22 @@ +package com.microsoft.azure.management.dns; + +import com.microsoft.azure.management.dns.implementation.RecordSetInner; +import com.microsoft.azure.management.resources.fluentcore.arm.models.ExternalChildResource; +import com.microsoft.azure.management.resources.fluentcore.arm.models.HasTags; +import com.microsoft.azure.management.resources.fluentcore.model.Wrapper; + +public interface DnsRecordSet extends + ExternalChildResource, + HasTags, + Wrapper { + + /** + * @return the type of records in this record set + */ + String recordType(); + + /** + * @return TTL of the records in this record set + */ + long timeToLive(); +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsZone.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsZone.java new file mode 100644 index 0000000000000..93ce1fd466377 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsZone.java @@ -0,0 +1,128 @@ +package com.microsoft.azure.management.dns; + +import com.microsoft.azure.management.apigeneration.Fluent; +import com.microsoft.azure.management.dns.implementation.ZoneInner; +import com.microsoft.azure.management.resources.fluentcore.arm.models.GroupableResource; +import com.microsoft.azure.management.resources.fluentcore.arm.models.Resource; +import com.microsoft.azure.management.resources.fluentcore.model.Appliable; +import com.microsoft.azure.management.resources.fluentcore.model.Creatable; +import com.microsoft.azure.management.resources.fluentcore.model.Refreshable; +import com.microsoft.azure.management.resources.fluentcore.model.Updatable; +import com.microsoft.azure.management.resources.fluentcore.model.Wrapper; + +import java.util.List; + + +/** + * An immutable client-side representation of an Azure DNS Zone. + */ +@Fluent +public interface DnsZone extends + GroupableResource, + Refreshable, + Wrapper, + Updatable { + /** + * @return the maximum number of record sets that can be created in this zone. + */ + long maxNumberOfRecordSets(); + + /** + * @return the current number of record sets in this zone. + */ + long numberOfRecordSets(); + + /** + * @return name servers assigned for this zone. + */ + List nameServers(); + + /** + * @return entry point to manage record sets in this zone containing A (Ipv4 address) records + */ + ARecordSets aRecordSets(); + + /** + * @return entry point to manage record sets in this zone containing AAAA (IPv6 address) records + */ + AaaaRecordSets aaaaRecordSets(); + + /** + * @return entry point to manage record sets in this zone containing CName (canonical name) records + */ + CnameRecordSets cnameRecordSets(); + + /** + * @return entry point to manage record sets in this zone containing Mx (mail exchange) records + */ + MxRecordSets mxRecordSets(); + + /** + * @return entry point to manage record sets in this zone containing Ns (name server) records + */ + NsRecordSets nsRecordSets(); + + /** + * @return entry point to manage record sets in this zone containing Ptr (pointer) records + */ + PtrRecordSets ptrRecordSets(); + + /** + * @return entry point to manage record sets in this zone containing Srv (service) records + */ + SrvRecordSets srvRecordSets(); + + /** + * @return entry point to manage record sets in this zone containing Txt (text) records + */ + TxtRecordSets txtRecordSets(); + + /** + * @return entry point to manage record sets in this zone containing Soa (start of authority) records + */ + SoaRecordSets soaRecordSets(); + + /** + * The entirety of the Dns zone definition. + */ + interface Definition extends + DefinitionStages.Blank, + DefinitionStages.WithCreate { + } + + /** + * Grouping of Dns zone definition stages. + */ + interface DefinitionStages { + /** + * The stage of the Dns zone definition allowing to specify the resource group. + */ + interface Blank extends GroupableResource.DefinitionStages.WithGroupAndRegion { + } + + /** + * The stage of the definition which contains all the minimum required inputs for the resource to be created + * (via {@link WithCreate#create()}), but also allows for any other optional settings to be specified. + */ + interface WithCreate extends + Creatable, + Resource.DefinitionWithTags { + } + } + + /** + * Grouping of Dns zone update stages. + */ + interface UpdateStages { + } + + /** + * The template for an update operation, containing all the settings that can be modified. + *

+ * Call {@link Update#apply()} to apply the changes to the resource in Azure. + */ + interface Update extends + Appliable, + Resource.UpdateWithTags { + } +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSet.java new file mode 100644 index 0000000000000..4adf5d9f01463 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSet.java @@ -0,0 +1,91 @@ +package com.microsoft.azure.management.dns; + +import com.microsoft.azure.management.resources.fluentcore.arm.models.HasTags; +import com.microsoft.azure.management.resources.fluentcore.model.Appliable; +import com.microsoft.azure.management.resources.fluentcore.model.Creatable; + +import java.util.List; + +/** + * An immutable client-side representation of a Mx record set in Azure Dns Zone. + */ +public interface MxRecordSet extends DnsRecordSet { + /** + * @return the Mx records in this record set + */ + List records(); + + /** + * The entirety of the CName record set definition. + */ + interface Definition extends + DefinitionStages.Blank, + DefinitionStages.WithCreate { + } + + /** + * Grouping of Mx record set definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Mx record set definition. + */ + interface Blank { + // TODO + } + + /** + * The stage of the record set definition allowing to specify Ttl for the records in this record set. + */ + interface WithTtl { + /** + * Specifies the Ttl for the records in the record set. + * + * @param ttlInSeconds ttl in seconds + * @return the next stage of the record set definition + */ + WithCreate withTimeToLive(long ttlInSeconds); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends + Creatable, + HasTags.DefinitionWithTags, + DefinitionStages.WithTtl { + } + } + + /** + * Grouping of Mx record set update stages. + */ + interface UpdateStages { + /** + * The stage of the record set update allowing to specify Ttl for the records in this record set. + */ + interface WithTtl { + /** + * Specifies the Ttl for the records in the record set. + * + * @param ttlInSeconds ttl in seconds + * @return the next stage of the record set update + */ + Update withTimeToLive(long ttlInSeconds); + } + } + + /** + * The template for an update operation, containing all the settings that + * can be modified. + *

+ * Call {@link Update#apply()} to apply the changes to the resource in Azure. + */ + interface Update extends + Appliable, + HasTags.UpdateWithTags, + UpdateStages.WithTtl { + } +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSets.java new file mode 100644 index 0000000000000..7266af6e40c30 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSets.java @@ -0,0 +1,7 @@ +package com.microsoft.azure.management.dns; + +/** + * Created by anuthomaschandy on 10/31/16. + */ +public interface MxRecordSets { +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/NsRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/NsRecordSet.java new file mode 100644 index 0000000000000..f78a97706f5f6 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/NsRecordSet.java @@ -0,0 +1,88 @@ +package com.microsoft.azure.management.dns; + +import com.microsoft.azure.management.resources.fluentcore.arm.models.HasTags; +import com.microsoft.azure.management.resources.fluentcore.model.Appliable; +import com.microsoft.azure.management.resources.fluentcore.model.Creatable; + +import java.util.List; + +public interface NsRecordSet extends DnsRecordSet { + /** + * @return the name server names of Ns records in this record set + */ + List nameServers(); + + /** + * The entirety of the Ns record set definition. + */ + interface Definition extends + DefinitionStages.Blank, + DefinitionStages.WithCreate { + } + + /** + * Grouping of Ns record set definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Ns record set definition. + */ + interface Blank { + // TODO + } + + /** + * The stage of the record set definition allowing to specify Ttl for the records in this record set. + */ + interface WithTtl { + /** + * Specifies the Ttl for the records in the record set. + * + * @param ttlInSeconds ttl in seconds + * @return the next stage of the record set definition + */ + WithCreate withTimeToLive(long ttlInSeconds); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends + Creatable, + HasTags.DefinitionWithTags, + DefinitionStages.WithTtl { + } + } + + /** + * Grouping of Ns record set update stages. + */ + interface UpdateStages { + /** + * The stage of the record set update allowing to specify Ttl for the records in this record set. + */ + interface WithTtl { + /** + * Specifies the Ttl for the records in the record set. + * + * @param ttlInSeconds ttl in seconds + * @return the next stage of the record set update + */ + Update withTimeToLive(long ttlInSeconds); + } + } + + /** + * The template for an update operation, containing all the settings that + * can be modified. + *

+ * Call {@link Update#apply()} to apply the changes to the resource in Azure. + */ + interface Update extends + Appliable, + HasTags.UpdateWithTags, + UpdateStages.WithTtl { + } +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/NsRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/NsRecordSets.java new file mode 100644 index 0000000000000..52eff66349131 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/NsRecordSets.java @@ -0,0 +1,7 @@ +package com.microsoft.azure.management.dns; + +/** + * Created by anuthomaschandy on 10/31/16. + */ +public interface NsRecordSets { +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/PtrRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/PtrRecordSet.java new file mode 100644 index 0000000000000..cbd93c5898d95 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/PtrRecordSet.java @@ -0,0 +1,91 @@ +package com.microsoft.azure.management.dns; + +import com.microsoft.azure.management.resources.fluentcore.arm.models.HasTags; +import com.microsoft.azure.management.resources.fluentcore.model.Appliable; +import com.microsoft.azure.management.resources.fluentcore.model.Creatable; + +import java.util.List; + +/** + * An immutable client-side representation of a Ptr record set in Azure Dns Zone. + */ +public interface PtrRecordSet extends DnsRecordSet { + /** + * @return the target domain names of Ptr records in this record set + */ + List targetDomainNames(); + + /** + * The entirety of the Ns record set definition. + */ + interface Definition extends + DefinitionStages.Blank, + DefinitionStages.WithCreate { + } + + /** + * Grouping of Ptr record set definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Ptr record set definition. + */ + interface Blank { + // TODO + } + + /** + * The stage of the record set definition allowing to specify Ttl for the records in this record set. + */ + interface WithTtl { + /** + * Specifies the Ttl for the records in the record set. + * + * @param ttlInSeconds ttl in seconds + * @return the next stage of the record set definition + */ + WithCreate withTimeToLive(long ttlInSeconds); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends + Creatable, + HasTags.DefinitionWithTags, + DefinitionStages.WithTtl { + } + } + + /** + * Grouping of Ptr record set update stages. + */ + interface UpdateStages { + /** + * The stage of the record set update allowing to specify Ttl for the records in this record set. + */ + interface WithTtl { + /** + * Specifies the Ttl for the records in the record set. + * + * @param ttlInSeconds ttl in seconds + * @return the next stage of the record set update + */ + Update withTimeToLive(long ttlInSeconds); + } + } + + /** + * The template for an update operation, containing all the settings that + * can be modified. + *

+ * Call {@link Update#apply()} to apply the changes to the resource in Azure. + */ + interface Update extends + Appliable, + HasTags.UpdateWithTags, + UpdateStages.WithTtl { + } +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/PtrRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/PtrRecordSets.java new file mode 100644 index 0000000000000..463cf497ba991 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/PtrRecordSets.java @@ -0,0 +1,7 @@ +package com.microsoft.azure.management.dns; + +/** + * Created by anuthomaschandy on 10/31/16. + */ +public interface PtrRecordSets { +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SoaRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SoaRecordSet.java new file mode 100644 index 0000000000000..f2554b8484e55 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SoaRecordSet.java @@ -0,0 +1,13 @@ +package com.microsoft.azure.management.dns; + +import java.util.List; + +/** + * An immutable client-side representation of a Soa record set in Azure Dns Zone. + */ +public interface SoaRecordSet extends DnsRecordSet { + /** + * @return the Soa records in this record set + */ + List records(); +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SoaRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SoaRecordSets.java new file mode 100644 index 0000000000000..4b296a89700ca --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SoaRecordSets.java @@ -0,0 +1,7 @@ +package com.microsoft.azure.management.dns; + +/** + * Created by anuthomaschandy on 10/31/16. + */ +public class SoaRecordSets { +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SrvRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SrvRecordSet.java new file mode 100644 index 0000000000000..128bcbcc3b0ae --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SrvRecordSet.java @@ -0,0 +1,91 @@ +package com.microsoft.azure.management.dns; + +import com.microsoft.azure.management.resources.fluentcore.arm.models.HasTags; +import com.microsoft.azure.management.resources.fluentcore.model.Appliable; +import com.microsoft.azure.management.resources.fluentcore.model.Creatable; + +import java.util.List; + +/** + * An immutable client-side representation of a Srv record set in Azure Dns Zone. + */ +public interface SrvRecordSet extends DnsRecordSet { + /** + * @return the Srv records in this record set + */ + List records(); + + /** + * The entirety of the Srv record set definition. + */ + interface Definition extends + DefinitionStages.Blank, + DefinitionStages.WithCreate { + } + + /** + * Grouping of Srv record set definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Srv record set definition. + */ + interface Blank { + // TODO + } + + /** + * The stage of the record set definition allowing to specify Ttl for the records in this record set. + */ + interface WithTtl { + /** + * Specifies the Ttl for the records in the record set. + * + * @param ttlInSeconds ttl in seconds + * @return the next stage of the record set definition + */ + WithCreate withTimeToLive(long ttlInSeconds); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends + Creatable, + HasTags.DefinitionWithTags, + DefinitionStages.WithTtl { + } + } + + /** + * Grouping of Srv record set update stages. + */ + interface UpdateStages { + /** + * The stage of the record set update allowing to specify Ttl for the records in this record set. + */ + interface WithTtl { + /** + * Specifies the Ttl for the records in the record set. + * + * @param ttlInSeconds ttl in seconds + * @return the next stage of the record set update + */ + Update withTimeToLive(long ttlInSeconds); + } + } + + /** + * The template for an update operation, containing all the settings that + * can be modified. + *

+ * Call {@link Update#apply()} to apply the changes to the resource in Azure. + */ + interface Update extends + Appliable, + HasTags.UpdateWithTags, + UpdateStages.WithTtl { + } +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SrvRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SrvRecordSets.java new file mode 100644 index 0000000000000..a050695f2c3c0 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SrvRecordSets.java @@ -0,0 +1,7 @@ +package com.microsoft.azure.management.dns; + +/** + * Created by anuthomaschandy on 10/31/16. + */ +public interface SrvRecordSets { +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSet.java new file mode 100644 index 0000000000000..b2b9af2dbd2ed --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSet.java @@ -0,0 +1,91 @@ +package com.microsoft.azure.management.dns; + +import com.microsoft.azure.management.resources.fluentcore.arm.models.HasTags; +import com.microsoft.azure.management.resources.fluentcore.model.Appliable; +import com.microsoft.azure.management.resources.fluentcore.model.Creatable; + +import java.util.List; + +/** + * An immutable client-side representation of a Txt record set in Azure Dns Zone. + */ +public interface TxtRecordSet extends DnsRecordSet { + /** + * @return the Txt records in this record set + */ + List records(); + + /** + * The entirety of the Txt record set definition. + */ + interface Definition extends + DefinitionStages.Blank, + DefinitionStages.WithCreate { + } + + /** + * Grouping of Txt record set definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Txt record set definition. + */ + interface Blank { + // TODO + } + + /** + * The stage of the record set definition allowing to specify Ttl for the records in this record set. + */ + interface WithTtl { + /** + * Specifies the Ttl for the records in the record set. + * + * @param ttlInSeconds ttl in seconds + * @return the next stage of the record set definition + */ + WithCreate withTimeToLive(long ttlInSeconds); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends + Creatable, + HasTags.DefinitionWithTags, + DefinitionStages.WithTtl { + } + } + + /** + * Grouping of Txt record set update stages. + */ + interface UpdateStages { + /** + * The stage of the record set update allowing to specify Ttl for the records in this record set. + */ + interface WithTtl { + /** + * Specifies the Ttl for the records in the record set. + * + * @param ttlInSeconds ttl in seconds + * @return the next stage of the record set update + */ + Update withTimeToLive(long ttlInSeconds); + } + } + + /** + * The template for an update operation, containing all the settings that + * can be modified. + *

+ * Call {@link Update#apply()} to apply the changes to the resource in Azure. + */ + interface Update extends + Appliable, + HasTags.UpdateWithTags, + UpdateStages.WithTtl { + } +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSets.java new file mode 100644 index 0000000000000..3a0573ad3aa60 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSets.java @@ -0,0 +1,7 @@ +package com.microsoft.azure.management.dns; + +/** + * Created by anuthomaschandy on 10/31/16. + */ +public interface TxtRecordSets { +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsRecordSetImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsRecordSetImpl.java new file mode 100644 index 0000000000000..0cde3d3ce38c3 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsRecordSetImpl.java @@ -0,0 +1,71 @@ +package com.microsoft.azure.management.dns.implementation; + +import com.microsoft.azure.management.dns.DnsRecordSet; +import com.microsoft.azure.management.resources.fluentcore.model.implementation.CreatableUpdatableImpl; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * Implementation of {@link DnsRecordSet}. + * + * @param The record set fluent model type + * @param the implementation type of the fluent model type + */ +abstract class DnsRecordSetImpl> + extends CreatableUpdatableImpl + implements DnsRecordSet { + protected final DnsZoneImpl dnsZone; + protected final RecordSetsInner client; + + DnsRecordSetImpl(final DnsZoneImpl parentDnsZone, final RecordSetInner innerModel, final RecordSetsInner client) { + super(innerModel.name(), innerModel); + this.dnsZone = parentDnsZone; + this.client = client; + } + + @Override + public String id() { + return inner().id(); + } + + @Override + public String recordType() { + return this.inner().type(); + } + + @Override + public long timeToLive() { + return this.inner().tTL(); + } + + @Override + public Map tags() { + if (this.inner().metadata() == null) { + return Collections.unmodifiableMap(new LinkedHashMap()); + } + return Collections.unmodifiableMap(this.inner().metadata()); + } + + public final FluentModelImplT withTags(Map tags) { + this.inner().withMetadata(new HashMap<>(tags)); + return (FluentModelImplT) this; + } + + public final FluentModelImplT withTag(String key, String value) { + this.inner().metadata().put(key, value); + return (FluentModelImplT) this; + } + + public final FluentModelImplT withoutTag(String key) { + this.inner().metadata().remove(key); + return (FluentModelImplT) this; + } + + public FluentModelImplT withTimeToLive(long ttlInSeconds) { + this.inner().withTTL(ttlInSeconds); + return (FluentModelImplT) this; + } +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsZoneImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsZoneImpl.java new file mode 100644 index 0000000000000..9547b1812f025 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsZoneImpl.java @@ -0,0 +1,7 @@ +package com.microsoft.azure.management.dns.implementation; + +/** + * Created by anuthomaschandy on 10/31/16. + */ +public class DnsZoneImpl { +} diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/HasTags.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/HasTags.java new file mode 100644 index 0000000000000..52ee19953ed35 --- /dev/null +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/HasTags.java @@ -0,0 +1,67 @@ +package com.microsoft.azure.management.resources.fluentcore.arm.models; + +import com.microsoft.azure.management.apigeneration.Fluent; + +import java.util.Map; + +/** + * An interface representing a resource that has tags. + */ +@Fluent +public interface HasTags { + /** + * @return the tags associated with the resource + */ + Map tags(); + + /** + * A resource definition allowing tags to be modified for the resource. + * + * @param the type of the next stage resource definition + */ + interface DefinitionWithTags { + /** + * Specifies tags for the resource as a {@link Map}. + * @param tags a {@link Map} of tags + * @return the next stage of the resource definition + */ + T withTags(Map tags); + + /** + * Adds a tag to the resource. + * @param key the key for the tag + * @param value the value for the tag + * @return the next stage of the resource definition + */ + T withTag(String key, String value); + } + + /** + * An update allowing tags to be modified for the resource. + * + * @param the type of the next stage resource update + */ + interface UpdateWithTags { + /** + * Specifies tags for the resource as a {@link Map}. + * @param tags a {@link Map} of tags + * @return the next stage of the resource update + */ + T withTags(Map tags); + + /** + * Adds a tag to the resource. + * @param key the key for the tag + * @param value the value for the tag + * @return the next stage of the resource update + */ + T withTag(String key, String value); + + /** + * Removes a tag from the resource. + * @param key the key of the tag to remove + * @return the next stage of the resource update + */ + T withoutTag(String key); + } +} diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/Resource.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/Resource.java index d309286c561bc..1c6cf5b10a55c 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/Resource.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/models/Resource.java @@ -19,7 +19,8 @@ public interface Resource extends Indexable, HasId, - HasName { + HasName, + HasTags { /** * @return the type of the resource @@ -36,11 +37,6 @@ public interface Resource extends */ Region region(); - /** - * @return the tags for the resource - */ - Map tags(); - /** * A resource definition allowing a location be selected for the resource. * @@ -69,21 +65,7 @@ interface DefinitionWithRegion { * @param the type of the next stage resource definition */ @LangDefinition(ContainerName = "Resource.Definition", ContainerFileName = "IDefinition") - interface DefinitionWithTags { - /** - * Specifies tags for the resource as a {@link Map}. - * @param tags a {@link Map} of tags - * @return the next stage of the resource definition - */ - T withTags(Map tags); - - /** - * Adds a tag to the resource. - * @param key the key for the tag - * @param value the value for the tag - * @return the next stage of the resource definition - */ - T withTag(String key, String value); + interface DefinitionWithTags extends HasTags.DefinitionWithTags { } /** @@ -92,27 +74,6 @@ interface DefinitionWithTags { * @param the type of the next stage resource update */ @LangDefinition(ContainerName = "Resource.Update", ContainerFileName = "IUpdate") - interface UpdateWithTags { - /** - * Specifies tags for the resource as a {@link Map}. - * @param tags a {@link Map} of tags - * @return the next stage of the resource update - */ - T withTags(Map tags); - - /** - * Adds a tag to the resource. - * @param key the key for the tag - * @param value the value for the tag - * @return the next stage of the resource update - */ - T withTag(String key, String value); - - /** - * Removes a tag from the resource. - * @param key the key of the tag to remove - * @return the next stage of the resource update - */ - T withoutTag(String key); + interface UpdateWithTags extends HasTags.UpdateWithTags { } } From b3efe160413cfc917df27db4f16c0aa7e788a86e Mon Sep 17 00:00:00 2001 From: anuchan Date: Tue, 1 Nov 2016 15:00:21 -0700 Subject: [PATCH 2/7] Adding definition and update stages for various record set models --- .../azure/management/dns/ARecordSet.java | 46 ++++++- .../azure/management/dns/AaaaRecordSet.java | 42 +++++- .../azure/management/dns/CnameRecordSet.java | 44 +++++- .../azure/management/dns/DnsRecordSet.java | 3 + .../azure/management/dns/MxRecordSet.java | 45 ++++++- .../azure/management/dns/NsRecordSet.java | 42 +++++- .../azure/management/dns/PtrRecordSet.java | 42 +++++- .../azure/management/dns/SoaRecordSet.java | 126 +++++++++++++++++- .../azure/management/dns/TxtRecordSet.java | 42 +++++- 9 files changed, 403 insertions(+), 29 deletions(-) diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/ARecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/ARecordSet.java index f9fe0fb05476b..181582aa69ec6 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/ARecordSet.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/ARecordSet.java @@ -7,16 +7,16 @@ import java.util.List; /** - * An immutable client-side representation of a A record set in Azure Dns Zone. + * An immutable client-side representation of a A (Ipv4) record set in Azure Dns Zone. */ public interface ARecordSet extends DnsRecordSet { /** - * @return the IPv4 addresses of A records in this record set + * @return the Ipv4 addresses of A records in this record set */ List ipv4Addresses(); /** - * The entirety of the Aaaa record set definition. + * The entirety of the A record set definition. */ interface Definition extends DefinitionStages.Blank, @@ -28,10 +28,22 @@ interface Definition extends */ interface DefinitionStages { /** - * The first stage of a A record set definition. + * The first stage of an A record set definition. */ - interface Blank { - // TODO + interface Blank extends WithIpv4Address { + } + + /** + * The stage of the A record set definition allowing to add a record. + */ + interface WithIpv4Address { + /** + * Creates an A record with the provided Ipv4 address in this record set. + * + * @param ipv4Address the Ipv4 address + * @return the next stage of the record set definition + */ + WithCreate withIpv4Address(String ipv4Address); } /** @@ -63,6 +75,27 @@ interface WithCreate extends * Grouping of A record set update stages. */ interface UpdateStages { + /** + * The stage of the Aaaa record set update allowing to add or remove a record. + */ + interface WithIpv4Address { + /** + * Creates an A record with the provided Ipv4 address in this record set. + * + * @param ipv4Address the Ipv4 address + * @return the next stage of the record set update + */ + Update withIpv4Address(String ipv4Address); + + /** + * Removes an A record with the provided Ipv4 address from this record set. + * + * @param ipv4Address the Ipv4 address + * @return the next stage of the record set update + */ + Update withoutIpv4Address(String ipv4Address); + } + /** * The stage of the record set update allowing to specify Ttl for the records in this record set. */ @@ -86,6 +119,7 @@ interface WithTtl { interface Update extends Appliable, HasTags.UpdateWithTags, + UpdateStages.WithIpv4Address, UpdateStages.WithTtl { } } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSet.java index 5ed33e7fbc8f1..483b12b8294b6 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSet.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSet.java @@ -7,7 +7,7 @@ import java.util.List; /** - * An immutable client-side representation of a Aaaa record set in Azure Dns Zone. + * An immutable client-side representation of a Aaaa (Ipv6) record set in Azure Dns Zone. */ public interface AaaaRecordSet extends DnsRecordSet { /** @@ -20,6 +20,7 @@ public interface AaaaRecordSet extends DnsRecordSet { */ interface Definition extends DefinitionStages.Blank, + DefinitionStages.WithIpv6Address, DefinitionStages.WithCreate { } @@ -30,8 +31,20 @@ interface DefinitionStages { /** * The first stage of a Aaaa record set definition. */ - interface Blank { - // TODO + interface Blank extends WithIpv6Address { + } + + /** + * The stage of the Aaaa record set definition allowing to add a record. + */ + interface WithIpv6Address { + /** + * Creates an Aaaa record with the provided Ipv6 address in this record set. + * + * @param ipv6Address the Ipv6 address + * @return the next stage of the record set definition + */ + WithCreate withIp6Address(String ipv6Address); } /** @@ -55,6 +68,7 @@ interface WithTtl { interface WithCreate extends Creatable, HasTags.DefinitionWithTags, + DefinitionStages.WithIpv6Address, DefinitionStages.WithTtl { } } @@ -63,6 +77,27 @@ interface WithCreate extends * Grouping of Aaaa record set update stages. */ interface UpdateStages { + /** + * The stage of the Aaaa record set update allowing to add or remove a record. + */ + interface WithIpv6Address { + /** + * Creates an Aaaa record with the provided Ipv6 address in this record set. + * + * @param ipv6Address the Ipv6 address + * @return the next stage of the record set update + */ + Update withIpv6Address(String ipv6Address); + + /** + * Removes an Aaaa record with the provided Ipv6 address from this record set. + * + * @param ipv6Address the Ipv6 address + * @return the next stage of the record set update + */ + Update withoutIpv6Address(String ipv6Address); + } + /** * The stage of the record set update allowing to specify Ttl for the records in this record set. */ @@ -86,6 +121,7 @@ interface WithTtl { interface Update extends Appliable, HasTags.UpdateWithTags, + UpdateStages.WithIpv6Address, UpdateStages.WithTtl { } } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSet.java index 105cab8c72deb..9b0fbc426556e 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSet.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSet.java @@ -7,11 +7,11 @@ import java.util.List; /** - * An immutable client-side representation of a CName record set in Azure Dns Zone. + * An immutable client-side representation of a CName (canonical name) record set in Azure Dns Zone. */ public interface CnameRecordSet extends DnsRecordSet { /** - * @return the canonical names (without a terminating dot) of CNAME records in this record set + * @return the canonical names (without a terminating dot) of CName records in this record set */ List canonicalNames(); @@ -20,6 +20,7 @@ public interface CnameRecordSet extends DnsRecordSet { */ interface Definition extends DefinitionStages.Blank, + DefinitionStages.WithCanonicalName, DefinitionStages.WithCreate { } @@ -30,8 +31,20 @@ interface DefinitionStages { /** * The first stage of a CName record set definition. */ - interface Blank { - // TODO + interface Blank extends WithCanonicalName { + } + + /** + * The stage of the CName record set definition allowing to add a record. + */ + interface WithCanonicalName { + /** + * Creates a CName record with the provided canonical name in this record set. + * + * @param canonicalName the canonical name + * @return the next stage of the record set definition + */ + WithCreate withCanonicalName(String canonicalName); } /** @@ -55,6 +68,7 @@ interface WithTtl { interface WithCreate extends Creatable, HasTags.DefinitionWithTags, + DefinitionStages.WithCanonicalName, DefinitionStages.WithTtl { } } @@ -63,6 +77,27 @@ interface WithCreate extends * Grouping of CName record set update stages. */ interface UpdateStages { + /** + * The stage of the CName record set update allowing to add or remove a record. + */ + interface WithCanonicalName { + /** + * Creates a CName record with the provided canonical name in this record set. + * + * @param canonicalName the canonical name + * @return the next stage of the record set update + */ + Update withCanonicalName(String canonicalName); + + /** + * Removes a CName record with the provided canonical name from this record set. + * + * @param canonicalName the canonical name + * @return the next stage of the record set update + */ + Update withoutCanonicalName(String canonicalName); + } + /** * The stage of the record set update allowing to specify Ttl for the records in this record set. */ @@ -86,6 +121,7 @@ interface WithTtl { interface Update extends Appliable, HasTags.UpdateWithTags, + UpdateStages.WithCanonicalName, UpdateStages.WithTtl { } } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsRecordSet.java index daa2e633b1601..727480069bd72 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsRecordSet.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsRecordSet.java @@ -5,6 +5,9 @@ import com.microsoft.azure.management.resources.fluentcore.arm.models.HasTags; import com.microsoft.azure.management.resources.fluentcore.model.Wrapper; +/** + * An immutable client-side representation of a record set in Azure Dns Zone. + */ public interface DnsRecordSet extends ExternalChildResource, HasTags, diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSet.java index 4adf5d9f01463..86741c7bc591d 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSet.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSet.java @@ -7,7 +7,7 @@ import java.util.List; /** - * An immutable client-side representation of a Mx record set in Azure Dns Zone. + * An immutable client-side representation of a Mx (mail exchange) record set in Azure Dns Zone. */ public interface MxRecordSet extends DnsRecordSet { /** @@ -20,6 +20,7 @@ public interface MxRecordSet extends DnsRecordSet { */ interface Definition extends DefinitionStages.Blank, + DefinitionStages.WithMailExchange, DefinitionStages.WithCreate { } @@ -30,8 +31,21 @@ interface DefinitionStages { /** * The first stage of a Mx record set definition. */ - interface Blank { - // TODO + interface Blank extends WithMailExchange { + } + + /** + * The stage of the Mx record set definition allowing to add a record. + */ + interface WithMailExchange { + /** + * Creates and assigns priority to a Mx record with the provided mail exchange server in this record set. + * + * @param priority the priority for the mail exchange host, lower the value higher the priority + * @param mailExchangeHostName the host name of the mail exchange server + * @return the next stage of the record set definition + */ + WithCreate withMailExchange(int priority, String mailExchangeHostName); } /** @@ -55,6 +69,7 @@ interface WithTtl { interface WithCreate extends Creatable, HasTags.DefinitionWithTags, + DefinitionStages.WithMailExchange, DefinitionStages.WithTtl { } } @@ -63,6 +78,29 @@ interface WithCreate extends * Grouping of Mx record set update stages. */ interface UpdateStages { + /** + * The stage of the Mx record set definition allowing to add or remove a record. + */ + interface WithMailExchange { + /** + * Creates and assigns priority to a Mx record with the provided mail exchange server in this record set. + * + * @param priority the priority for the mail exchange host, lower the value higher the priority + * @param mailExchangeHostName the host name of the mail exchange server + * @return the next stage of the record set update + */ + Update withMailExchange(int priority, String mailExchangeHostName); + + /** + * Removes a Mx record with the provided priority and mail exchange server from this record set. + * + * @param priority the priority for the mail exchange host + * @param mailExchangeHostName the host name of the mail exchange server + * @return the next stage of the record set update + */ + Update withoutMailExchange(int priority, String mailExchangeHostName); + } + /** * The stage of the record set update allowing to specify Ttl for the records in this record set. */ @@ -86,6 +124,7 @@ interface WithTtl { interface Update extends Appliable, HasTags.UpdateWithTags, + UpdateStages.WithMailExchange, UpdateStages.WithTtl { } } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/NsRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/NsRecordSet.java index f78a97706f5f6..527537db4ad29 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/NsRecordSet.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/NsRecordSet.java @@ -8,7 +8,7 @@ public interface NsRecordSet extends DnsRecordSet { /** - * @return the name server names of Ns records in this record set + * @return the name server names of Ns (name server) records in this record set */ List nameServers(); @@ -17,6 +17,7 @@ public interface NsRecordSet extends DnsRecordSet { */ interface Definition extends DefinitionStages.Blank, + DefinitionStages.WithNameServer, DefinitionStages.WithCreate { } @@ -27,8 +28,20 @@ interface DefinitionStages { /** * The first stage of a Ns record set definition. */ - interface Blank { - // TODO + interface Blank extends WithNameServer { + } + + /** + * The stage of the Ns record set definition allowing to add a record. + */ + interface WithNameServer { + /** + * Creates a Ns record with the provided name server in this record set. + * + * @param nameServerHostName the name server host name + * @return the next stage of the record set definition + */ + WithCreate withNameServer(String nameServerHostName); } /** @@ -52,6 +65,7 @@ interface WithTtl { interface WithCreate extends Creatable, HasTags.DefinitionWithTags, + DefinitionStages.WithNameServer, DefinitionStages.WithTtl { } } @@ -60,6 +74,27 @@ interface WithCreate extends * Grouping of Ns record set update stages. */ interface UpdateStages { + /** + * The stage of the Ns record set definition allowing to add or remove a record. + */ + interface WithNameServer { + /** + * Creates a Ns record with the provided name server in this record set. + * + * @param nameServerHostName the name server host name + * @return the next stage of the record set definition + */ + Update withNameServer(String nameServerHostName); + + /** + * Removes a Ns record with the provided name server from this record set. + * + * @param nameServerHostName the name server host name + * @return the next stage of the record set definition + */ + Update withoutNameServer(String nameServerHostName); + } + /** * The stage of the record set update allowing to specify Ttl for the records in this record set. */ @@ -83,6 +118,7 @@ interface WithTtl { interface Update extends Appliable, HasTags.UpdateWithTags, + UpdateStages.WithNameServer, UpdateStages.WithTtl { } } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/PtrRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/PtrRecordSet.java index cbd93c5898d95..8049b1601dd8f 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/PtrRecordSet.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/PtrRecordSet.java @@ -7,7 +7,7 @@ import java.util.List; /** - * An immutable client-side representation of a Ptr record set in Azure Dns Zone. + * An immutable client-side representation of a Ptr (pointer) record set in Azure Dns Zone. */ public interface PtrRecordSet extends DnsRecordSet { /** @@ -20,6 +20,7 @@ public interface PtrRecordSet extends DnsRecordSet { */ interface Definition extends DefinitionStages.Blank, + DefinitionStages.WithTargetDomain, DefinitionStages.WithCreate { } @@ -30,8 +31,20 @@ interface DefinitionStages { /** * The first stage of a Ptr record set definition. */ - interface Blank { - // TODO + interface Blank extends WithTargetDomain { + } + + /** + * The stage of the Ptr record set definition allowing to add a record. + */ + interface WithTargetDomain { + /** + * Creates a Ptr record with the provided target domain in this record set. + * + * @param targetDomainName the name of the target domain + * @return the next stage of the record set definition + */ + WithCreate withTargetDomain(String targetDomainName); } /** @@ -55,6 +68,7 @@ interface WithTtl { interface WithCreate extends Creatable, HasTags.DefinitionWithTags, + DefinitionStages.WithTargetDomain, DefinitionStages.WithTtl { } } @@ -63,6 +77,27 @@ interface WithCreate extends * Grouping of Ptr record set update stages. */ interface UpdateStages { + /** + * The stage of the Ptr record set definition allowing to add or remove a record. + */ + interface WithTargetDomain { + /** + * Creates a Ptr record with the provided target domain in this record set. + * + * @param targetDomainName the name of the target domain + * @return the next stage of the record set update + */ + Update withTargetDomain(String targetDomainName); + + /** + * Removes a Ptr record with the provided target domain from this record set. + * + * @param targetDomainName the name of the target domain + * @return the next stage of the record set update + */ + Update withoutTargetDomain(String targetDomainName); + } + /** * The stage of the record set update allowing to specify Ttl for the records in this record set. */ @@ -86,6 +121,7 @@ interface WithTtl { interface Update extends Appliable, HasTags.UpdateWithTags, + UpdateStages.WithTargetDomain, UpdateStages.WithTtl { } } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SoaRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SoaRecordSet.java index f2554b8484e55..f9e917aa03d96 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SoaRecordSet.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SoaRecordSet.java @@ -1,13 +1,131 @@ package com.microsoft.azure.management.dns; -import java.util.List; +import com.microsoft.azure.management.resources.fluentcore.arm.models.HasTags; +import com.microsoft.azure.management.resources.fluentcore.model.Appliable; /** - * An immutable client-side representation of a Soa record set in Azure Dns Zone. + * An immutable client-side representation of a Soa (start of authority) record set in Azure Dns Zone. */ public interface SoaRecordSet extends DnsRecordSet { /** - * @return the Soa records in this record set + * @return the Soa record in this record set */ - List records(); + SoaRecord record(); + + /** + * Grouping of Soa record set update stages. + */ + interface UpdateStages { + /** + * The stage of the Soa record set definition allowing specify the email server. + */ + interface WithEmailServer { + /** + * Specifies the email server associated with the Soa record. + * + * @param emailServerHostName the email server + * @return the next stage of the record set update + */ + Update withEmailServer(String emailServerHostName); + } + + /** + * The stage of the Soa record set definition allowing to specify the refresh time. + */ + interface WithRefreshTime { + /** + * Specifies time in seconds that a secondary name server should wait before trying to contact the + * the primary name server for a zone file update. + * + * @param refreshTimeInSeconds the refresh time in seconds + * @return the next stage of the record set update + */ + Update withRefreshTimeInSeconds(int refreshTimeInSeconds); + } + + /** + * The stage of the Soa record set definition allowing to specify the retry time. + */ + interface WithRetryTime { + /** + * Specifies the time in seconds that a secondary name server should wait before trying to contact + * the primary name server again after a failed attempt to check for a zone file update. + * + * @param refreshTimeInSeconds the retry time in seconds + * @return the next stage of the record set update + */ + Update withRetryTimeInSeconds(int refreshTimeInSeconds); + } + + /** + * The stage of the Soa record set definition allowing to specify the expire time. + */ + interface WithExpireTime { + /** + * Specifies the time in seconds that a secondary name server will treat its cached zone file as valid + * when the primary name server cannot be contacted. + * + * @param expireTimeInSeconds the expire time in seconds + * @return the next stage of the record set update + */ + Update withExpireTimeInSeconds(int expireTimeInSeconds); + } + + /** + * The stage of the Soa record set definition allowing to specify the Ttl for cached negative response. + */ + interface WithNegativeCachingTtl { + /** + * Specifies the time in seconds that any name server or resolver should cache a negative response. + * + * @param negativeCachingTimeToLive the Ttl for cached negative response + * @return the next stage of the record set update + */ + Update withNegativeCachingTimeToLiveInSeconds(int negativeCachingTimeToLive); + } + + /** + * The stage of the Soa record set definition allowing to specify the serial number. + */ + interface WithSerialNumber { + /** + * Specifies the serial number for the zone file. + * + * @param serialNumber the serial number + * @return the next stage of the record set update + */ + Update withSerialNumber(int serialNumber); + } + + /** + * The stage of the record set update allowing to specify Ttl for the records in this record set. + */ + interface WithTtl { + /** + * Specifies the Ttl for the records in the record set. + * + * @param ttlInSeconds ttl in seconds + * @return the next stage of the record set update + */ + Update withTimeToLive(long ttlInSeconds); + } + } + + /** + * The template for an update operation, containing all the settings that + * can be modified. + *

+ * Call {@link Update#apply()} to apply the changes to the resource in Azure. + */ + interface Update extends + Appliable, + HasTags.UpdateWithTags, + UpdateStages.WithEmailServer, + UpdateStages.WithRefreshTime, + UpdateStages.WithRetryTime, + UpdateStages.WithExpireTime, + UpdateStages.WithNegativeCachingTtl, + UpdateStages.WithSerialNumber, + UpdateStages.WithTtl { + } } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSet.java index b2b9af2dbd2ed..e23b167e67681 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSet.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSet.java @@ -7,7 +7,7 @@ import java.util.List; /** - * An immutable client-side representation of a Txt record set in Azure Dns Zone. + * An immutable client-side representation of a Txt (text) record set in Azure Dns Zone. */ public interface TxtRecordSet extends DnsRecordSet { /** @@ -20,6 +20,7 @@ public interface TxtRecordSet extends DnsRecordSet { */ interface Definition extends DefinitionStages.Blank, + DefinitionStages.WithText, DefinitionStages.WithCreate { } @@ -30,8 +31,20 @@ interface DefinitionStages { /** * The first stage of a Txt record set definition. */ - interface Blank { - // TODO + interface Blank extends WithText { + } + + /** + * The stage of the Txt record set definition allowing to add a record. + */ + interface WithText { + /** + * Creates a Txt record with the given text in this record set. + * + * @param text the text value + * @return the next stage of the record set definition + */ + WithCreate withText(String text); } /** @@ -55,6 +68,7 @@ interface WithTtl { interface WithCreate extends Creatable, HasTags.DefinitionWithTags, + DefinitionStages.WithText, DefinitionStages.WithTtl { } } @@ -63,6 +77,27 @@ interface WithCreate extends * Grouping of Txt record set update stages. */ interface UpdateStages { + /** + * The stage of the Txt record set definition allowing to add or remove a record. + */ + interface WithText { + /** + * Creates a Txt record with the given text in this record set. + * + * @param text the text value + * @return the next stage of the record set update + */ + Update withText(String text); + + /** + * Removes Txt record with the given text from this record set. + * + * @param text the text value + * @return the next stage of the record set update + */ + Update withoutText(String text); + } + /** * The stage of the record set update allowing to specify Ttl for the records in this record set. */ @@ -86,6 +121,7 @@ interface WithTtl { interface Update extends Appliable, HasTags.UpdateWithTags, + UpdateStages.WithText, UpdateStages.WithTtl { } } From d60b6f480ab3dadf1fbd269a0719ba49220763a3 Mon Sep 17 00:00:00 2001 From: anuchan Date: Tue, 1 Nov 2016 15:52:21 -0700 Subject: [PATCH 3/7] extending record sets collection interface from various operation interfaces --- .../azure/management/dns/ARecordSets.java | 16 ++++++++++++++-- .../azure/management/dns/AaaaRecordSets.java | 16 ++++++++++++++-- .../azure/management/dns/CnameRecordSets.java | 16 ++++++++++++++-- .../azure/management/dns/DnsRecordSets.java | 19 +++++++++++++++++++ .../azure/management/dns/DnsZone.java | 5 ++--- .../azure/management/dns/MxRecordSets.java | 18 +++++++++++++++--- .../azure/management/dns/NsRecordSets.java | 18 +++++++++++++++--- .../azure/management/dns/PtrRecordSets.java | 16 ++++++++++++++-- .../azure/management/dns/SoaRecordSets.java | 13 +++++++++++-- .../azure/management/dns/SrvRecordSets.java | 18 +++++++++++++++--- .../azure/management/dns/TxtRecordSets.java | 18 +++++++++++++++--- 11 files changed, 148 insertions(+), 25 deletions(-) create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsRecordSets.java diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/ARecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/ARecordSets.java index c8e8464637ea7..dbae95b48a512 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/ARecordSets.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/ARecordSets.java @@ -1,7 +1,19 @@ package com.microsoft.azure.management.dns; +import com.microsoft.azure.management.apigeneration.Fluent; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeletingById; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; + /** - * Created by anuthomaschandy on 10/31/16. + * Entry point to Dns zone A record set management API. */ -public interface ARecordSets { +@Fluent +public interface ARecordSets extends + DnsRecordSets, + SupportsListing, + SupportsGettingById, + SupportsCreating, + SupportsDeletingById { } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSets.java index 2b2412f58b0e8..e7d3236745b8f 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSets.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSets.java @@ -1,7 +1,19 @@ package com.microsoft.azure.management.dns; +import com.microsoft.azure.management.apigeneration.Fluent; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeletingById; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; + /** - * Created by anuthomaschandy on 10/31/16. + * Entry point to Dns zone Aaaa record set management API. */ -public interface AaaaRecordSets { +@Fluent +public interface AaaaRecordSets extends + DnsRecordSets, + SupportsListing, + SupportsGettingById, + SupportsCreating, + SupportsDeletingById { } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSets.java index a96c0af257bb1..b5f1d7720830a 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSets.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSets.java @@ -1,7 +1,19 @@ package com.microsoft.azure.management.dns; +import com.microsoft.azure.management.apigeneration.Fluent; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeletingById; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; + /** - * Created by anuthomaschandy on 10/31/16. + * Entry point to Dns zone CName record set management API. */ -public interface CnameRecordSets { +@Fluent +public interface CnameRecordSets extends + DnsRecordSets, + SupportsListing, + SupportsGettingById, + SupportsCreating, + SupportsDeletingById { } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsRecordSets.java new file mode 100644 index 0000000000000..3fe3a5900ec25 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsRecordSets.java @@ -0,0 +1,19 @@ +package com.microsoft.azure.management.dns; + +import com.microsoft.azure.management.apigeneration.Fluent; + +/** + * Base interface for various Dns record sets. + * + * @param the type of the record set + */ +@Fluent +public interface DnsRecordSets { + /** + * Gets the information about a Dns record set from Azure based on name. + * + * @param name the name of the record set + * @return the record set + */ + FluentRecordSetModelT getByName(String name); +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsZone.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsZone.java index 93ce1fd466377..cc4a2d8bb414a 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsZone.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsZone.java @@ -12,7 +12,6 @@ import java.util.List; - /** * An immutable client-side representation of an Azure DNS Zone. */ @@ -78,9 +77,9 @@ public interface DnsZone extends TxtRecordSets txtRecordSets(); /** - * @return entry point to manage record sets in this zone containing Soa (start of authority) records + * @return the Soa (start of authority) record associated with this Dns zone */ - SoaRecordSets soaRecordSets(); + SoaRecord getSoaRecord(); /** * The entirety of the Dns zone definition. diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSets.java index 7266af6e40c30..6a7aa036e2303 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSets.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSets.java @@ -1,7 +1,19 @@ package com.microsoft.azure.management.dns; +import com.microsoft.azure.management.apigeneration.Fluent; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeletingById; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; + /** - * Created by anuthomaschandy on 10/31/16. + * Entry point to Dns zone Mx record set management API. */ -public interface MxRecordSets { -} +@Fluent +public interface MxRecordSets extends + DnsRecordSets, + SupportsListing, + SupportsGettingById, + SupportsCreating, + SupportsDeletingById { +} \ No newline at end of file diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/NsRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/NsRecordSets.java index 52eff66349131..66541056cb632 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/NsRecordSets.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/NsRecordSets.java @@ -1,7 +1,19 @@ package com.microsoft.azure.management.dns; +import com.microsoft.azure.management.apigeneration.Fluent; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeletingById; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; + /** - * Created by anuthomaschandy on 10/31/16. + * Entry point to Dns zone Ns record set management API. */ -public interface NsRecordSets { -} +@Fluent +public interface NsRecordSets extends + DnsRecordSets, + SupportsListing, + SupportsGettingById, + SupportsCreating, + SupportsDeletingById { +} \ No newline at end of file diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/PtrRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/PtrRecordSets.java index 463cf497ba991..7e8fb2c1cfea2 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/PtrRecordSets.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/PtrRecordSets.java @@ -1,7 +1,19 @@ package com.microsoft.azure.management.dns; +import com.microsoft.azure.management.apigeneration.Fluent; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeletingById; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; + /** - * Created by anuthomaschandy on 10/31/16. + * Entry point to Dns zone Ptr record set management API. */ -public interface PtrRecordSets { +@Fluent +public interface PtrRecordSets extends + DnsRecordSets, + SupportsListing, + SupportsGettingById, + SupportsCreating, + SupportsDeletingById { } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SoaRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SoaRecordSets.java index 4b296a89700ca..b7ef30ed1bba2 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SoaRecordSets.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SoaRecordSets.java @@ -1,7 +1,16 @@ package com.microsoft.azure.management.dns; +import com.microsoft.azure.management.apigeneration.Fluent; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; + /** - * Created by anuthomaschandy on 10/31/16. + * Entry point to Dns zone Soa record set management API. */ -public class SoaRecordSets { +@Fluent +public interface SoaRecordSets extends + DnsRecordSets, + SupportsListing, + SupportsGettingById { } + diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SrvRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SrvRecordSets.java index a050695f2c3c0..d3a3b7576da4d 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SrvRecordSets.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SrvRecordSets.java @@ -1,7 +1,19 @@ package com.microsoft.azure.management.dns; +import com.microsoft.azure.management.apigeneration.Fluent; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeletingById; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; + /** - * Created by anuthomaschandy on 10/31/16. + * Entry point to Dns zone Srv record set management API. */ -public interface SrvRecordSets { -} +@Fluent +public interface SrvRecordSets extends + DnsRecordSets, + SupportsListing, + SupportsGettingById, + SupportsCreating, + SupportsDeletingById { +} \ No newline at end of file diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSets.java index 3a0573ad3aa60..d6b39a41be6a9 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSets.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSets.java @@ -1,7 +1,19 @@ package com.microsoft.azure.management.dns; +import com.microsoft.azure.management.apigeneration.Fluent; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeletingById; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; + /** - * Created by anuthomaschandy on 10/31/16. + * Entry point to Dns zone Txt record set management API. */ -public interface TxtRecordSets { -} +@Fluent +public interface TxtRecordSets extends + DnsRecordSets, + SupportsListing, + SupportsGettingById, + SupportsCreating, + SupportsDeletingById { +} \ No newline at end of file From 3551fb6583adc7635a60594e30344a046274b672 Mon Sep 17 00:00:00 2001 From: anuchan Date: Tue, 1 Nov 2016 17:40:51 -0700 Subject: [PATCH 4/7] Adding dns manager and couple of impls --- .../azure/management/dns/DnsZone.java | 4 +- .../azure/management/dns/DnsZones.java | 26 ++++ .../dns/implementation/DnsRecordSetImpl.java | 2 +- .../dns/implementation/DnsZoneImpl.java | 133 +++++++++++++++++- .../dns/implementation/DnsZoneManager.java | 94 +++++++++++++ .../dns/implementation/DnsZonesImpl.java | 71 ++++++++++ 6 files changed, 325 insertions(+), 5 deletions(-) create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsZones.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsZoneManager.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsZonesImpl.java diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsZone.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsZone.java index cc4a2d8bb414a..a8ffb08d92887 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsZone.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsZone.java @@ -77,9 +77,9 @@ public interface DnsZone extends TxtRecordSets txtRecordSets(); /** - * @return the Soa (start of authority) record associated with this Dns zone + * @return the record set containing Soa (start of authority) record associated with this Dns zone */ - SoaRecord getSoaRecord(); + SoaRecordSet getSoaRecordSet(); /** * The entirety of the Dns zone definition. diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsZones.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsZones.java new file mode 100644 index 0000000000000..e1af3df423806 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsZones.java @@ -0,0 +1,26 @@ +package com.microsoft.azure.management.dns; + +import com.microsoft.azure.management.apigeneration.Fluent; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsDeletingByGroup; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingByGroup; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsListingByGroup; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsBatchCreation; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeletingById; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; + +/** + * Entry point to Dns zone management API in Azure. + */ +@Fluent() +public interface DnsZones extends + SupportsCreating, + SupportsListing, + SupportsListingByGroup, + SupportsGettingByGroup, + SupportsGettingById, + SupportsDeletingById, + SupportsDeletingByGroup, + SupportsBatchCreation { +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsRecordSetImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsRecordSetImpl.java index 0cde3d3ce38c3..5e67fd74ee2f2 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsRecordSetImpl.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsRecordSetImpl.java @@ -20,7 +20,7 @@ abstract class DnsRecordSetImpl + implements + DnsZone, + DnsZone.Definition, + DnsZone.Update { + private final ZonesInner innerCollection; + private final RecordSetsInner recordSetsClient; + + private ARecordSets aRecordSets; + private AaaaRecordSets aaaaRecordSets; + private CnameRecordSets cnameRecordSets; + private MxRecordSets mxRecordSets; + private NsRecordSets nsRecordSets; + private PtrRecordSets ptrRecordSets; + private SrvRecordSets srvRecordSets; + private TxtRecordSets txtRecordSets; + + DnsZoneImpl(String name, + final ZoneInner innerModel, + final ZonesInner innerCollection, + final RecordSetsInner recordSetsClient, + final DnsZoneManager trafficManager) { + super(name, innerModel, trafficManager); + this.innerCollection = innerCollection; + this.recordSetsClient = recordSetsClient; + initRecordSets(); + } + + @Override + public long maxNumberOfRecordSets() { + return this.inner().maxNumberOfRecordSets(); + } + + @Override + public long numberOfRecordSets() { + return this.inner().numberOfRecordSets(); + } + + @Override + public List nameServers() { + return this.inner().nameServers(); + } + + @Override + public ARecordSets aRecordSets() { + return this.aRecordSets; + } + + @Override + public AaaaRecordSets aaaaRecordSets() { + return this.aaaaRecordSets; + } + + @Override + public CnameRecordSets cnameRecordSets() { + return this.cnameRecordSets; + } + + @Override + public MxRecordSets mxRecordSets() { + return this.mxRecordSets; + } + + @Override + public NsRecordSets nsRecordSets() { + return this.nsRecordSets; + } + + @Override + public PtrRecordSets ptrRecordSets() { + return this.ptrRecordSets; + } + + @Override + public SrvRecordSets srvRecordSets() { + return this.srvRecordSets; + } + + @Override + public TxtRecordSets txtRecordSets() { + return this.txtRecordSets; + } + + @Override + public SoaRecordSet getSoaRecordSet() { + // TODO: Do HTTP GET + return null; + } + + @Override + public Observable createResourceAsync() { + return null; + } + + @Override + public DnsZone refresh() { + return null; + } + + private void initRecordSets() { + this.aRecordSets = null; + this.aaaaRecordSets = null; + this.cnameRecordSets = null; + this.mxRecordSets = null; + this.nsRecordSets = null; + this.ptrRecordSets = null; + this.srvRecordSets = null; + this.txtRecordSets = null; + } } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsZoneManager.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsZoneManager.java new file mode 100644 index 0000000000000..170ca666ee353 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsZoneManager.java @@ -0,0 +1,94 @@ +package com.microsoft.azure.management.dns.implementation; + +import com.microsoft.azure.RestClient; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.dns.DnsZones; +import com.microsoft.azure.management.resources.fluentcore.arm.AzureConfigurable; +import com.microsoft.azure.management.resources.fluentcore.arm.implementation.AzureConfigurableImpl; +import com.microsoft.azure.management.resources.fluentcore.arm.implementation.Manager; + +/** + * Entry point to Azure Dns zone manager management. + */ +public class DnsZoneManager extends Manager { + // Collections + private DnsZones zones; + + /** + * Get a Configurable instance that can be used to create {@link DnsZoneManager} + * with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new DnsZoneManager.ConfigurableImpl(); + } + + /** + * Creates an instance of DnsZoneManager that exposes Dns zone manager management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the DnsZoneManager + */ + public static DnsZoneManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new DnsZoneManager(credentials.getEnvironment().newRestClientBuilder() + .withCredentials(credentials) + .build(), subscriptionId); + } + + /** + * Creates an instance of DnsZoneManager that exposes Dns zone manager management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the DnsZoneManager + */ + public static DnsZoneManager authenticate(RestClient restClient, String subscriptionId) { + return new DnsZoneManager(restClient, subscriptionId); + } + + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of DnsZoneManager that exposes traffic manager management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Dns zone manager management API entry points that work across subscriptions + */ + DnsZoneManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * The implementation for Configurable interface. + */ + private static class ConfigurableImpl + extends AzureConfigurableImpl + implements Configurable { + + public DnsZoneManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return DnsZoneManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + + private DnsZoneManager(RestClient restClient, String subscriptionId) { + super(restClient, + subscriptionId, + new DnsManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } + + /** + * @return entry point to Dns zone manager profile management + */ + public DnsZones zones() { + if (this.zones == null) { + this.zones = new DnsZonesImpl( + super.innerManagementClient, + this); + } + return this.zones; + } +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsZonesImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsZonesImpl.java new file mode 100644 index 0000000000000..4612d57f3232f --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsZonesImpl.java @@ -0,0 +1,71 @@ +package com.microsoft.azure.management.dns.implementation; + +import com.microsoft.azure.PagedList; +import com.microsoft.azure.management.dns.DnsZone; +import com.microsoft.azure.management.dns.DnsZones; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.GroupableResourcesImpl; +import rx.Observable; + +/** + * Implementation of {@link DnsZones}. + */ +class DnsZonesImpl extends GroupableResourcesImpl< + DnsZone, + DnsZoneImpl, + ZoneInner, + ZonesInner, + DnsZoneManager> + implements DnsZones { + private final RecordSetsInner recordSetsClient; + + DnsZonesImpl( + final DnsManagementClientImpl dnsManagementClient, + final DnsZoneManager dnsZoneManager) { + super(dnsManagementClient.zones(), dnsZoneManager); + this.recordSetsClient = dnsManagementClient.recordSets(); + } + + @Override + public PagedList list() { + return wrapList(this.innerCollection.listInSubscription()); + } + + @Override + public PagedList listByGroup(String groupName) { + return wrapList(this.innerCollection.listInResourceGroup(groupName)); + } + + @Override + public DnsZone getByGroup(String groupName, String name) { + return wrapModel(this.innerCollection.get(groupName, name)); + } + + @Override + public Observable deleteByGroupAsync(String groupName, String name) { + this.innerCollection.deleteAsync(groupName, name); + return Observable.just(null); + } + + @Override + public DnsZoneImpl define(String name) { + return wrapModel(name); + } + + @Override + protected DnsZoneImpl wrapModel(String name) { + return new DnsZoneImpl(name, + new ZoneInner(), + this.innerCollection, + this.recordSetsClient, + this.myManager); + } + + @Override + protected DnsZoneImpl wrapModel(ZoneInner inner) { + return new DnsZoneImpl(inner.name(), + inner, + this.innerCollection, + this.recordSetsClient, + this.myManager); + } +} From 8e643a02024d5c1dbdfbaad784a656ef9212db57 Mon Sep 17 00:00:00 2001 From: anuchan Date: Wed, 2 Nov 2016 12:01:27 -0700 Subject: [PATCH 5/7] Implementing recordset Impls --- .../azure/management/dns/CnameRecordSet.java | 27 +----------- .../azure/management/dns/DnsRecordSet.java | 2 +- .../dns/implementation/ARecordSetImpl.java | 42 ++++++++++++++++++ .../dns/implementation/AaaaRecordSetImpl.java | 43 +++++++++++++++++++ .../implementation/CnameRecordSetImpl.java | 35 +++++++++++++++ .../dns/implementation/DnsRecordSetImpl.java | 40 +++++++++++++++-- .../dns/implementation/MxRecordSetImpl.java | 40 +++++++++++++++++ .../dns/implementation/NsRecordSetImpl.java | 43 +++++++++++++++++++ .../dns/implementation/PtrRecordSetImpl.java | 43 +++++++++++++++++++ .../dns/implementation/TxtRecordSetImpl.java | 41 ++++++++++++++++++ 10 files changed, 327 insertions(+), 29 deletions(-) create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/ARecordSetImpl.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/AaaaRecordSetImpl.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/CnameRecordSetImpl.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/MxRecordSetImpl.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/NsRecordSetImpl.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/PtrRecordSetImpl.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/TxtRecordSetImpl.java diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSet.java index 9b0fbc426556e..7c0ace5c8f86f 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSet.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSet.java @@ -11,9 +11,9 @@ */ public interface CnameRecordSet extends DnsRecordSet { /** - * @return the canonical names (without a terminating dot) of CName records in this record set + * @return the canonical name (without a terminating dot) of CName record in this record set */ - List canonicalNames(); + String canonicalName(); /** * The entirety of the CName record set definition. @@ -68,7 +68,6 @@ interface WithTtl { interface WithCreate extends Creatable, HasTags.DefinitionWithTags, - DefinitionStages.WithCanonicalName, DefinitionStages.WithTtl { } } @@ -77,27 +76,6 @@ interface WithCreate extends * Grouping of CName record set update stages. */ interface UpdateStages { - /** - * The stage of the CName record set update allowing to add or remove a record. - */ - interface WithCanonicalName { - /** - * Creates a CName record with the provided canonical name in this record set. - * - * @param canonicalName the canonical name - * @return the next stage of the record set update - */ - Update withCanonicalName(String canonicalName); - - /** - * Removes a CName record with the provided canonical name from this record set. - * - * @param canonicalName the canonical name - * @return the next stage of the record set update - */ - Update withoutCanonicalName(String canonicalName); - } - /** * The stage of the record set update allowing to specify Ttl for the records in this record set. */ @@ -121,7 +99,6 @@ interface WithTtl { interface Update extends Appliable, HasTags.UpdateWithTags, - UpdateStages.WithCanonicalName, UpdateStages.WithTtl { } } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsRecordSet.java index 727480069bd72..a202f828324ea 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsRecordSet.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsRecordSet.java @@ -16,7 +16,7 @@ public interface DnsRecordSet extends /** * @return the type of records in this record set */ - String recordType(); + RecordType recordType(); /** * @return TTL of the records in this record set diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/ARecordSetImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/ARecordSetImpl.java new file mode 100644 index 0000000000000..a981bd0119295 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/ARecordSetImpl.java @@ -0,0 +1,42 @@ +package com.microsoft.azure.management.dns.implementation; + +import com.microsoft.azure.management.dns.ARecord; +import com.microsoft.azure.management.dns.ARecordSet; +import rx.functions.Func1; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * Implementation of {@link ARecordSet} + */ +class ARecordSetImpl + extends DnsRecordSetImpl + implements ARecordSet { + ARecordSetImpl(final DnsZoneImpl parentDnsZone, final RecordSetInner innerModel, final RecordSetsInner client) { + super(parentDnsZone, innerModel, client); + } + + @Override + public List ipv4Addresses() { + List ipv6Addresses = new ArrayList<>(); + if (this.inner().aaaaRecords() != null) { + for (ARecord aRecord : this.inner().aRecords()) { + ipv6Addresses.add(aRecord.ipv4Address()); + } + } + return Collections.unmodifiableList(ipv6Addresses); + } + + @Override + public ARecordSetImpl refresh() { + this.resetInner(); + return this; + } + + @Override + protected Func1 innerToFluentMap() { + return super.innerToFluentMap(this); + } +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/AaaaRecordSetImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/AaaaRecordSetImpl.java new file mode 100644 index 0000000000000..4342a036f3109 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/AaaaRecordSetImpl.java @@ -0,0 +1,43 @@ +package com.microsoft.azure.management.dns.implementation; + +import com.microsoft.azure.management.dns.AaaaRecord; +import com.microsoft.azure.management.dns.AaaaRecordSet; +import rx.functions.Func1; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * Implementation of {@link AaaaRecordSet} + */ +class AaaaRecordSetImpl + extends DnsRecordSetImpl + implements AaaaRecordSet { + + AaaaRecordSetImpl(final DnsZoneImpl parentDnsZone, final RecordSetInner innerModel, final RecordSetsInner client) { + super(parentDnsZone, innerModel, client); + } + + @Override + public List ipv6Addresses() { + List ipv6Addresses = new ArrayList<>(); + if (this.inner().aaaaRecords() != null) { + for (AaaaRecord aaaaRecord : this.inner().aaaaRecords()) { + ipv6Addresses.add(aaaaRecord.ipv6Address()); + } + } + return Collections.unmodifiableList(ipv6Addresses); + } + + @Override + public AaaaRecordSetImpl refresh() { + this.resetInner(); + return this; + } + + @Override + protected Func1 innerToFluentMap() { + return super.innerToFluentMap(this); + } +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/CnameRecordSetImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/CnameRecordSetImpl.java new file mode 100644 index 0000000000000..e30e6bc1159ae --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/CnameRecordSetImpl.java @@ -0,0 +1,35 @@ +package com.microsoft.azure.management.dns.implementation; + +import com.microsoft.azure.management.dns.ARecordSet; +import com.microsoft.azure.management.dns.CnameRecordSet; +import rx.functions.Func1; + +/** + * Implementation of {@link ARecordSet} + */ +class CnameRecordSetImpl + extends DnsRecordSetImpl + implements CnameRecordSet { + CnameRecordSetImpl(final DnsZoneImpl parentDnsZone, final RecordSetInner innerModel, final RecordSetsInner client) { + super(parentDnsZone, innerModel, client); + } + + @Override + public String canonicalName() { + if ( this.inner().cnameRecord() != null) { + return this.inner().cnameRecord().cname(); + } + return null; + } + + @Override + public CnameRecordSetImpl refresh() { + this.resetInner(); + return this; + } + + @Override + protected Func1 innerToFluentMap() { + return super.innerToFluentMap(this); + } +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsRecordSetImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsRecordSetImpl.java index 5e67fd74ee2f2..20c1fcdd05d35 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsRecordSetImpl.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsRecordSetImpl.java @@ -1,7 +1,12 @@ package com.microsoft.azure.management.dns.implementation; import com.microsoft.azure.management.dns.DnsRecordSet; +import com.microsoft.azure.management.dns.DnsZone; +import com.microsoft.azure.management.dns.RecordType; import com.microsoft.azure.management.resources.fluentcore.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import rx.functions.Func1; + import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashMap; @@ -16,7 +21,7 @@ abstract class DnsRecordSetImpl> extends CreatableUpdatableImpl - implements DnsRecordSet { + implements DnsRecordSet { protected final DnsZoneImpl dnsZone; protected final RecordSetsInner client; @@ -32,8 +37,8 @@ public String id() { } @Override - public String recordType() { - return this.inner().type(); + public RecordType recordType() { + return RecordType.fromString(this.inner().type()); } @Override @@ -41,6 +46,11 @@ public long timeToLive() { return this.inner().tTL(); } + @Override + public DnsZoneImpl parent() { + return this.dnsZone; + } + @Override public Map tags() { if (this.inner().metadata() == null) { @@ -68,4 +78,28 @@ public FluentModelImplT withTimeToLive(long ttlInSeconds) { this.inner().withTTL(ttlInSeconds); return (FluentModelImplT) this; } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + @Override + public Observable createResourceAsync() { + return client.createOrUpdateAsync(this.parent().resourceGroupName(), + this.parent().name(), + this.name(), + this.recordType(), + this.inner()) + .map(innerToFluentMap()); + } + + protected void resetInner() { + this.setInner(this.client.get(this.parent().resourceGroupName(), + this.parent().name(), + this.name(), + this.recordType())); + } + + protected abstract Func1 innerToFluentMap(); } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/MxRecordSetImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/MxRecordSetImpl.java new file mode 100644 index 0000000000000..97523e7b04b0b --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/MxRecordSetImpl.java @@ -0,0 +1,40 @@ +package com.microsoft.azure.management.dns.implementation; + +import com.microsoft.azure.management.dns.MxRecord; +import com.microsoft.azure.management.dns.MxRecordSet; +import rx.functions.Func1; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * Implementation of {@link MxRecordSet} + */ +class MxRecordSetImpl + extends DnsRecordSetImpl + implements MxRecordSet { + MxRecordSetImpl(final DnsZoneImpl parentDnsZone, final RecordSetInner innerModel, final RecordSetsInner client) { + super(parentDnsZone, innerModel, client); + } + + @Override + public List records() { + if (this.inner().mxRecords() != null) { + return Collections.unmodifiableList(this.inner().mxRecords()); + } + return Collections.unmodifiableList(new ArrayList()); + } + + @Override + public MxRecordSetImpl refresh() { + this.resetInner(); + return this; + } + + @Override + protected Func1 innerToFluentMap() { + return super.innerToFluentMap(this); + } +} + diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/NsRecordSetImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/NsRecordSetImpl.java new file mode 100644 index 0000000000000..724e27ec21123 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/NsRecordSetImpl.java @@ -0,0 +1,43 @@ +package com.microsoft.azure.management.dns.implementation; + +import com.microsoft.azure.management.dns.NsRecord; +import com.microsoft.azure.management.dns.NsRecordSet; +import rx.functions.Func1; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * Implementation of {@link NsRecordSet} + */ +class NsRecordSetImpl + extends DnsRecordSetImpl + implements NsRecordSet { + NsRecordSetImpl(final DnsZoneImpl parentDnsZone, final RecordSetInner innerModel, final RecordSetsInner client) { + super(parentDnsZone, innerModel, client); + } + + @Override + public List nameServers() { + List nameServers = new ArrayList<>(); + if (this.inner().aaaaRecords() != null) { + for (NsRecord nsRecord : this.inner().nsRecords()) { + nameServers.add(nsRecord.nsdname()); + } + } + return Collections.unmodifiableList(nameServers); + } + + @Override + public NsRecordSetImpl refresh() { + this.resetInner(); + return this; + } + + @Override + protected Func1 innerToFluentMap() { + return super.innerToFluentMap(this); + } +} + diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/PtrRecordSetImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/PtrRecordSetImpl.java new file mode 100644 index 0000000000000..f3f703093240f --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/PtrRecordSetImpl.java @@ -0,0 +1,43 @@ +package com.microsoft.azure.management.dns.implementation; + +import com.microsoft.azure.management.dns.PtrRecord; +import com.microsoft.azure.management.dns.PtrRecordSet; +import rx.functions.Func1; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * Implementation of {@link PtrRecordSet} + */ +class PtrRecordSetImpl + extends DnsRecordSetImpl + implements PtrRecordSet { + PtrRecordSetImpl(final DnsZoneImpl parentDnsZone, final RecordSetInner innerModel, final RecordSetsInner client) { + super(parentDnsZone, innerModel, client); + } + + @Override + public List targetDomainNames() { + List targetDomainNames = new ArrayList<>(); + if (this.inner().aaaaRecords() != null) { + for (PtrRecord ptrRecord : this.inner().ptrRecords()) { + targetDomainNames.add(ptrRecord.ptrdname()); + } + } + return Collections.unmodifiableList(targetDomainNames); + } + + @Override + public PtrRecordSetImpl refresh() { + this.resetInner(); + return this; + } + + @Override + protected Func1 innerToFluentMap() { + return super.innerToFluentMap(this); + } +} + diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/TxtRecordSetImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/TxtRecordSetImpl.java new file mode 100644 index 0000000000000..165abb2729492 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/TxtRecordSetImpl.java @@ -0,0 +1,41 @@ +package com.microsoft.azure.management.dns.implementation; + +import com.microsoft.azure.management.dns.TxtRecord; +import com.microsoft.azure.management.dns.TxtRecordSet; +import rx.functions.Func1; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * Implementation of {@link TxtRecordSet} + */ +class TxtRecordSetImpl + extends DnsRecordSetImpl + implements TxtRecordSet { + TxtRecordSetImpl(final DnsZoneImpl parentDnsZone, final RecordSetInner innerModel, final RecordSetsInner client) { + super(parentDnsZone, innerModel, client); + } + + @Override + public List records() { + if (this.inner().txtRecords() != null) { + return Collections.unmodifiableList(this.inner().txtRecords()); + } + return Collections.unmodifiableList(new ArrayList()); + } + + @Override + public TxtRecordSetImpl refresh() { + this.resetInner(); + return this; + } + + @Override + protected Func1 innerToFluentMap() { + return super.innerToFluentMap(this); + } +} + + From c4d4e9035f5cb89cf859285b3e8ac2628786b258 Mon Sep 17 00:00:00 2001 From: anuchan Date: Wed, 2 Nov 2016 14:38:15 -0700 Subject: [PATCH 6/7] Implementing definition-stages for all recordsets types --- .../azure/management/dns/AaaaRecordSet.java | 2 +- .../azure/management/dns/CnameRecordSet.java | 4 +- .../azure/management/dns/MxRecordSet.java | 12 ++-- .../azure/management/dns/SoaRecordSet.java | 10 +-- .../azure/management/dns/SrvRecordSet.java | 55 ++++++++++++-- .../azure/management/dns/TxtRecordSet.java | 4 +- .../dns/implementation/ARecordSetImpl.java | 29 +++++++- .../dns/implementation/AaaaRecordSetImpl.java | 29 +++++++- .../implementation/CnameRecordSetImpl.java | 14 +++- .../dns/implementation/DnsRecordSetImpl.java | 2 +- .../dns/implementation/DnsZoneImpl.java | 13 ++-- .../dns/implementation/MxRecordSetImpl.java | 29 +++++++- .../dns/implementation/NsRecordSetImpl.java | 29 +++++++- .../dns/implementation/PtrRecordSetImpl.java | 29 +++++++- .../dns/implementation/SoaRecordSetImpl.java | 70 ++++++++++++++++++ .../dns/implementation/SrvRecordSetImpl.java | 71 +++++++++++++++++++ .../dns/implementation/TxtRecordSetImpl.java | 33 ++++++++- 17 files changed, 394 insertions(+), 41 deletions(-) create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/SoaRecordSetImpl.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/SrvRecordSetImpl.java diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSet.java index 483b12b8294b6..bc9b12ea84977 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSet.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSet.java @@ -44,7 +44,7 @@ interface WithIpv6Address { * @param ipv6Address the Ipv6 address * @return the next stage of the record set definition */ - WithCreate withIp6Address(String ipv6Address); + WithCreate withIpv6Address(String ipv6Address); } /** diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSet.java index 7c0ace5c8f86f..39c7286007ddb 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSet.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSet.java @@ -66,7 +66,7 @@ interface WithTtl { * for any other optional settings to be specified. */ interface WithCreate extends - Creatable, + Creatable, HasTags.DefinitionWithTags, DefinitionStages.WithTtl { } @@ -97,7 +97,7 @@ interface WithTtl { * Call {@link Update#apply()} to apply the changes to the resource in Azure. */ interface Update extends - Appliable, + Appliable, HasTags.UpdateWithTags, UpdateStages.WithTtl { } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSet.java index 86741c7bc591d..5546741d736f9 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSet.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSet.java @@ -41,11 +41,11 @@ interface WithMailExchange { /** * Creates and assigns priority to a Mx record with the provided mail exchange server in this record set. * - * @param priority the priority for the mail exchange host, lower the value higher the priority * @param mailExchangeHostName the host name of the mail exchange server + * @param priority the priority for the mail exchange host, lower the value higher the priority * @return the next stage of the record set definition */ - WithCreate withMailExchange(int priority, String mailExchangeHostName); + WithCreate withMailExchange(String mailExchangeHostName, int priority); } /** @@ -85,20 +85,20 @@ interface WithMailExchange { /** * Creates and assigns priority to a Mx record with the provided mail exchange server in this record set. * - * @param priority the priority for the mail exchange host, lower the value higher the priority * @param mailExchangeHostName the host name of the mail exchange server + * @param priority the priority for the mail exchange host, lower the value higher the priority * @return the next stage of the record set update */ - Update withMailExchange(int priority, String mailExchangeHostName); + Update withMailExchange(String mailExchangeHostName, int priority); /** * Removes a Mx record with the provided priority and mail exchange server from this record set. * - * @param priority the priority for the mail exchange host * @param mailExchangeHostName the host name of the mail exchange server + * @param priority the priority for the mail exchange host * @return the next stage of the record set update */ - Update withoutMailExchange(int priority, String mailExchangeHostName); + Update withoutMailExchange(String mailExchangeHostName, int priority); } /** diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SoaRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SoaRecordSet.java index f9e917aa03d96..59fbdfd50e4da 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SoaRecordSet.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SoaRecordSet.java @@ -40,7 +40,7 @@ interface WithRefreshTime { * @param refreshTimeInSeconds the refresh time in seconds * @return the next stage of the record set update */ - Update withRefreshTimeInSeconds(int refreshTimeInSeconds); + Update withRefreshTimeInSeconds(long refreshTimeInSeconds); } /** @@ -54,7 +54,7 @@ interface WithRetryTime { * @param refreshTimeInSeconds the retry time in seconds * @return the next stage of the record set update */ - Update withRetryTimeInSeconds(int refreshTimeInSeconds); + Update withRetryTimeInSeconds(long refreshTimeInSeconds); } /** @@ -68,7 +68,7 @@ interface WithExpireTime { * @param expireTimeInSeconds the expire time in seconds * @return the next stage of the record set update */ - Update withExpireTimeInSeconds(int expireTimeInSeconds); + Update withExpireTimeInSeconds(long expireTimeInSeconds); } /** @@ -81,7 +81,7 @@ interface WithNegativeCachingTtl { * @param negativeCachingTimeToLive the Ttl for cached negative response * @return the next stage of the record set update */ - Update withNegativeCachingTimeToLiveInSeconds(int negativeCachingTimeToLive); + Update withNegativeResponseCachingTimeToLiveInSeconds(long negativeCachingTimeToLive); } /** @@ -94,7 +94,7 @@ interface WithSerialNumber { * @param serialNumber the serial number * @return the next stage of the record set update */ - Update withSerialNumber(int serialNumber); + Update withSerialNumber(long serialNumber); } /** diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SrvRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SrvRecordSet.java index 128bcbcc3b0ae..a8a4c15ec641f 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SrvRecordSet.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SrvRecordSet.java @@ -7,7 +7,7 @@ import java.util.List; /** - * An immutable client-side representation of a Srv record set in Azure Dns Zone. + * An immutable client-side representation of a Srv (service) record set in Azure Dns Zone. */ public interface SrvRecordSet extends DnsRecordSet { /** @@ -20,6 +20,7 @@ public interface SrvRecordSet extends DnsRecordSet { */ interface Definition extends DefinitionStages.Blank, + DefinitionStages.WithRecord, DefinitionStages.WithCreate { } @@ -30,8 +31,23 @@ interface DefinitionStages { /** * The first stage of a Srv record set definition. */ - interface Blank { - // TODO + interface Blank extends WithRecord { + } + + /** + * The stage of the srv record set definition allowing to add a Srv record. + */ + interface WithRecord { + /** + * Specifies a service record for a service. + * + * @param target the canonical name of the target host running the service + * @param port the port on which the service is bounded + * @param priority the priority of the target host, lower the value higher the priority + * @param weight the relative weight (preference) of the records with the same priority, higher the value more the preference + * @return the next stage of the record set definition + */ + WithCreate withRecord(String target, int port, int priority, int weight); } /** @@ -53,8 +69,9 @@ interface WithTtl { * for any other optional settings to be specified. */ interface WithCreate extends - Creatable, + Creatable, HasTags.DefinitionWithTags, + DefinitionStages.WithRecord, DefinitionStages.WithTtl { } } @@ -63,6 +80,33 @@ interface WithCreate extends * Grouping of Srv record set update stages. */ interface UpdateStages { + /** + * The stage of the srv record set update allowing to add or remove a Srv record. + */ + interface WithRecord { + /** + * Specifies a service record for a service. + * + * @param target the canonical name of the target host running the service + * @param port the port on which the service is bounded + * @param priority the priority of the target host, lower the value higher the priority + * @param weight the relative weight (preference) of the records with the same priority, higher the value more the preference + * @return the next stage of the record set update + */ + Update withRecord(String target, int port, int priority, int weight); + + /** + * Removes a service record. + * + * @param target the canonical name of the target host running the service + * @param port the port on which the service is bounded + * @param priority the priority of the record + * @param weight the weight of the record + * @return the next stage of the record set update + */ + Update withoutRecord(String target, int port, int priority, int weight); + } + /** * The stage of the record set update allowing to specify Ttl for the records in this record set. */ @@ -84,8 +128,9 @@ interface WithTtl { * Call {@link Update#apply()} to apply the changes to the resource in Azure. */ interface Update extends - Appliable, + Appliable, HasTags.UpdateWithTags, + UpdateStages.WithRecord, UpdateStages.WithTtl { } } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSet.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSet.java index e23b167e67681..34e34296d7959 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSet.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSet.java @@ -66,7 +66,7 @@ interface WithTtl { * for any other optional settings to be specified. */ interface WithCreate extends - Creatable, + Creatable, HasTags.DefinitionWithTags, DefinitionStages.WithText, DefinitionStages.WithTtl { @@ -119,7 +119,7 @@ interface WithTtl { * Call {@link Update#apply()} to apply the changes to the resource in Azure. */ interface Update extends - Appliable, + Appliable, HasTags.UpdateWithTags, UpdateStages.WithText, UpdateStages.WithTtl { diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/ARecordSetImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/ARecordSetImpl.java index a981bd0119295..d4ef7c184c62c 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/ARecordSetImpl.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/ARecordSetImpl.java @@ -13,7 +13,10 @@ */ class ARecordSetImpl extends DnsRecordSetImpl - implements ARecordSet { + implements + ARecordSet, + ARecordSet.Definition, + ARecordSet.Update { ARecordSetImpl(final DnsZoneImpl parentDnsZone, final RecordSetInner innerModel, final RecordSetsInner client) { super(parentDnsZone, innerModel, client); } @@ -31,7 +34,29 @@ public List ipv4Addresses() { @Override public ARecordSetImpl refresh() { - this.resetInner(); + this.refreshInner(); + return this; + } + + @Override + public ARecordSetImpl withIpv4Address(String ipv4Address) { + if (this.inner().aRecords() == null) { + this.inner().withARecords(new ArrayList()); + } + this.inner().aRecords().add(new ARecord().withIpv4Address(ipv4Address)); + return this; + } + + @Override + public ARecordSetImpl withoutIpv4Address(String ipv4Address) { + if (this.inner().aRecords() != null) { + for (ARecord record : this.inner().aRecords()) { + if (record.ipv4Address().equalsIgnoreCase(ipv4Address)) { + this.inner().aRecords().remove(record); + break; + } + } + } return this; } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/AaaaRecordSetImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/AaaaRecordSetImpl.java index 4342a036f3109..b6110188018bb 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/AaaaRecordSetImpl.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/AaaaRecordSetImpl.java @@ -13,7 +13,10 @@ */ class AaaaRecordSetImpl extends DnsRecordSetImpl - implements AaaaRecordSet { + implements + AaaaRecordSet, + AaaaRecordSet.Definition, + AaaaRecordSet.Update { AaaaRecordSetImpl(final DnsZoneImpl parentDnsZone, final RecordSetInner innerModel, final RecordSetsInner client) { super(parentDnsZone, innerModel, client); @@ -32,7 +35,29 @@ public List ipv6Addresses() { @Override public AaaaRecordSetImpl refresh() { - this.resetInner(); + this.refreshInner(); + return this; + } + + @Override + public AaaaRecordSetImpl withIpv6Address(String ipv6Address) { + if (this.inner().aaaaRecords() == null) { + this.inner().withAaaaRecords(new ArrayList()); + } + this.inner().aaaaRecords().add(new AaaaRecord().withIpv6Address(ipv6Address)); + return this; + } + + @Override + public AaaaRecordSetImpl withoutIpv6Address(String ipv6Address) { + if (this.inner().aaaaRecords() != null) { + for (AaaaRecord record : this.inner().aaaaRecords()) { + if (record.ipv6Address().equalsIgnoreCase(ipv6Address)) { + this.inner().aaaaRecords().remove(record); + break; + } + } + } return this; } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/CnameRecordSetImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/CnameRecordSetImpl.java index e30e6bc1159ae..584ba41a18c5e 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/CnameRecordSetImpl.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/CnameRecordSetImpl.java @@ -1,6 +1,7 @@ package com.microsoft.azure.management.dns.implementation; import com.microsoft.azure.management.dns.ARecordSet; +import com.microsoft.azure.management.dns.CnameRecord; import com.microsoft.azure.management.dns.CnameRecordSet; import rx.functions.Func1; @@ -9,7 +10,10 @@ */ class CnameRecordSetImpl extends DnsRecordSetImpl - implements CnameRecordSet { + implements + CnameRecordSet, + CnameRecordSet.Definition, + CnameRecordSet.Update { CnameRecordSetImpl(final DnsZoneImpl parentDnsZone, final RecordSetInner innerModel, final RecordSetsInner client) { super(parentDnsZone, innerModel, client); } @@ -24,7 +28,13 @@ public String canonicalName() { @Override public CnameRecordSetImpl refresh() { - this.resetInner(); + this.refreshInner(); + return this; + } + + @Override + public CnameRecordSetImpl withCanonicalName(String canonicalName) { + this.inner().withCnameRecord(new CnameRecord().withCname(canonicalName)); return this; } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsRecordSetImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsRecordSetImpl.java index 20c1fcdd05d35..e524eb8c2505f 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsRecordSetImpl.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsRecordSetImpl.java @@ -94,7 +94,7 @@ public Observable createResourceAsync() { .map(innerToFluentMap()); } - protected void resetInner() { + protected void refreshInner() { this.setInner(this.client.get(this.parent().resourceGroupName(), this.parent().name(), this.name(), diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsZoneImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsZoneImpl.java index 4c91089a404fa..23df5095a7b16 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsZoneImpl.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsZoneImpl.java @@ -1,13 +1,13 @@ package com.microsoft.azure.management.dns.implementation; import com.microsoft.azure.management.dns.ARecordSets; -import com.microsoft.azure.management.dns.AaaaRecord; import com.microsoft.azure.management.dns.AaaaRecordSets; import com.microsoft.azure.management.dns.CnameRecordSets; import com.microsoft.azure.management.dns.DnsZone; import com.microsoft.azure.management.dns.MxRecordSets; import com.microsoft.azure.management.dns.NsRecordSets; import com.microsoft.azure.management.dns.PtrRecordSets; +import com.microsoft.azure.management.dns.RecordType; import com.microsoft.azure.management.dns.SoaRecordSet; import com.microsoft.azure.management.dns.SrvRecordSets; import com.microsoft.azure.management.dns.TxtRecordSets; @@ -109,18 +109,21 @@ public TxtRecordSets txtRecordSets() { @Override public SoaRecordSet getSoaRecordSet() { - // TODO: Do HTTP GET - return null; + RecordSetInner inner = this.recordSetsClient.get(this.resourceGroupName(), this.name(), "@", RecordType.SOA); + return new SoaRecordSetImpl(this, inner, this.recordSetsClient); } @Override public Observable createResourceAsync() { - return null; + return this.innerCollection.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); } @Override public DnsZone refresh() { - return null; + ZoneInner inner = this.innerCollection.get(this.resourceGroupName(), this.name()); + this.setInner(inner); + return this; } private void initRecordSets() { diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/MxRecordSetImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/MxRecordSetImpl.java index 97523e7b04b0b..dbd827f130491 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/MxRecordSetImpl.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/MxRecordSetImpl.java @@ -13,7 +13,10 @@ */ class MxRecordSetImpl extends DnsRecordSetImpl - implements MxRecordSet { + implements + MxRecordSet, + MxRecordSet.Definition, + MxRecordSet.Update { MxRecordSetImpl(final DnsZoneImpl parentDnsZone, final RecordSetInner innerModel, final RecordSetsInner client) { super(parentDnsZone, innerModel, client); } @@ -28,7 +31,29 @@ public List records() { @Override public MxRecordSetImpl refresh() { - this.resetInner(); + this.refreshInner(); + return this; + } + + @Override + public MxRecordSetImpl withMailExchange(String mailExchangeHostName, int priority) { + if (this.inner().mxRecords() == null) { + this.inner().withMxRecords(new ArrayList()); + } + this.inner().mxRecords().add(new MxRecord().withExchange(mailExchangeHostName).withPreference(priority)); + return this; + } + + @Override + public MxRecordSetImpl withoutMailExchange(String mailExchangeHostName, int priority) { + if (this.inner().mxRecords() != null) { + for (MxRecord record : this.inner().mxRecords()) { + if (record.exchange().equalsIgnoreCase(mailExchangeHostName) && record.preference() == priority) { + this.inner().mxRecords().remove(record); + break; + } + } + } return this; } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/NsRecordSetImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/NsRecordSetImpl.java index 724e27ec21123..61b3795f0882d 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/NsRecordSetImpl.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/NsRecordSetImpl.java @@ -13,7 +13,10 @@ */ class NsRecordSetImpl extends DnsRecordSetImpl - implements NsRecordSet { + implements + NsRecordSet, + NsRecordSet.Definition, + NsRecordSet.Update { NsRecordSetImpl(final DnsZoneImpl parentDnsZone, final RecordSetInner innerModel, final RecordSetsInner client) { super(parentDnsZone, innerModel, client); } @@ -31,7 +34,29 @@ public List nameServers() { @Override public NsRecordSetImpl refresh() { - this.resetInner(); + this.refreshInner(); + return this; + } + + @Override + public NsRecordSetImpl withNameServer(String nameServerHostName) { + if (this.inner().nsRecords() == null) { + this.inner().withNsRecords(new ArrayList()); + } + this.inner().nsRecords().add(new NsRecord().withNsdname(nameServerHostName)); + return this; + } + + @Override + public NsRecordSetImpl withoutNameServer(String nameServerHostName) { + if (this.inner().nsRecords() != null) { + for (NsRecord record : this.inner().nsRecords()) { + if (record.nsdname().equalsIgnoreCase(nameServerHostName)) { + this.inner().nsRecords().remove(record); + break; + } + } + } return this; } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/PtrRecordSetImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/PtrRecordSetImpl.java index f3f703093240f..c5e4519825d06 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/PtrRecordSetImpl.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/PtrRecordSetImpl.java @@ -13,7 +13,10 @@ */ class PtrRecordSetImpl extends DnsRecordSetImpl - implements PtrRecordSet { + implements + PtrRecordSet, + PtrRecordSet.Definition, + PtrRecordSet.Update { PtrRecordSetImpl(final DnsZoneImpl parentDnsZone, final RecordSetInner innerModel, final RecordSetsInner client) { super(parentDnsZone, innerModel, client); } @@ -31,7 +34,29 @@ public List targetDomainNames() { @Override public PtrRecordSetImpl refresh() { - this.resetInner(); + this.refreshInner(); + return this; + } + + @Override + public PtrRecordSetImpl withTargetDomain(String targetDomainName) { + if (this.inner().ptrRecords() == null) { + this.inner().withPtrRecords(new ArrayList()); + } + this.inner().ptrRecords().add(new PtrRecord().withPtrdname(targetDomainName)); + return this; + } + + @Override + public PtrRecordSetImpl withoutTargetDomain(String targetDomainName) { + if (this.inner().nsRecords() != null) { + for (PtrRecord record : this.inner().ptrRecords()) { + if (record.ptrdname().equalsIgnoreCase(targetDomainName)) { + this.inner().ptrRecords().remove(record); + break; + } + } + } return this; } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/SoaRecordSetImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/SoaRecordSetImpl.java new file mode 100644 index 0000000000000..40610231eb12b --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/SoaRecordSetImpl.java @@ -0,0 +1,70 @@ +package com.microsoft.azure.management.dns.implementation; + +import com.microsoft.azure.management.dns.SoaRecord; +import com.microsoft.azure.management.dns.SoaRecordSet; +import rx.functions.Func1; + +/** + * Implementation of {@link SoaRecordSet} + */ +class SoaRecordSetImpl + extends DnsRecordSetImpl + implements + SoaRecordSet, + SoaRecordSet.Update { + SoaRecordSetImpl(final DnsZoneImpl parentDnsZone, final RecordSetInner innerModel, final RecordSetsInner client) { + super(parentDnsZone, innerModel, client); + } + + @Override + public SoaRecord record() { + return this.inner().soaRecord(); + } + + @Override + public SoaRecordSetImpl refresh() { + this.refreshInner(); + return this; + } + + @Override + public SoaRecordSetImpl withEmailServer(String emailServerHostName) { + this.inner().soaRecord().withEmail(emailServerHostName); + return this; + } + + @Override + public SoaRecordSetImpl withExpireTimeInSeconds(long expireTimeInSeconds) { + this.inner().soaRecord().withExpireTime(expireTimeInSeconds); + return this; + } + + @Override + public SoaRecordSetImpl withNegativeResponseCachingTimeToLiveInSeconds(long negativeCachingTimeToLive) { + this.inner().soaRecord().withMinimumTtl(negativeCachingTimeToLive); + return this; + } + + @Override + public SoaRecordSetImpl withRefreshTimeInSeconds(long refreshTimeInSeconds) { + this.inner().soaRecord().withRefreshTime(refreshTimeInSeconds); + return this; + } + + @Override + public SoaRecordSetImpl withRetryTimeInSeconds(long refreshTimeInSeconds) { + this.inner().soaRecord().withRetryTime(refreshTimeInSeconds); + return this; + } + + @Override + public SoaRecordSetImpl withSerialNumber(long serialNumber) { + this.inner().soaRecord().withSerialNumber(serialNumber); + return this; + } + + @Override + protected Func1 innerToFluentMap() { + return super.innerToFluentMap(this); + } +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/SrvRecordSetImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/SrvRecordSetImpl.java new file mode 100644 index 0000000000000..1da34ec61b9cc --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/SrvRecordSetImpl.java @@ -0,0 +1,71 @@ +package com.microsoft.azure.management.dns.implementation; + +import com.microsoft.azure.management.dns.SrvRecord; +import com.microsoft.azure.management.dns.SrvRecordSet; +import rx.functions.Func1; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * Implementation of {@link SrvRecordSet} + */ +class SrvRecordSetImpl + extends DnsRecordSetImpl + implements + SrvRecordSet, + SrvRecordSet.Definition, + SrvRecordSet.Update { + SrvRecordSetImpl(final DnsZoneImpl parentDnsZone, final RecordSetInner innerModel, final RecordSetsInner client) { + super(parentDnsZone, innerModel, client); + } + + @Override + public List records() { + if (this.inner().srvRecords() != null) { + return Collections.unmodifiableList(this.inner().srvRecords()); + } + return Collections.unmodifiableList(new ArrayList()); + } + + @Override + public SrvRecordSetImpl refresh() { + this.refreshInner(); + return this; + } + + @Override + public SrvRecordSetImpl withRecord(String target, int port, int priority, int weight) { + if (this.inner().srvRecords() == null) { + this.inner().withSrvRecords(new ArrayList()); + } + this.inner().srvRecords().add(new SrvRecord() + .withTarget(target) + .withPort(port) + .withPriority(priority) + .withWeight(weight)); + return this; + } + + @Override + public SrvRecordSetImpl withoutRecord(String target, int port, int priority, int weight) { + if (this.inner().srvRecords() != null) { + for (SrvRecord record : this.inner().srvRecords()) { + if (record.target().equalsIgnoreCase(target) && + record.port() == port && + record.priority() == priority && + record.weight() == weight) { + this.inner().srvRecords().remove(record); + break; + } + } + } + return this; + } + + @Override + protected Func1 innerToFluentMap() { + return super.innerToFluentMap(this); + } +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/TxtRecordSetImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/TxtRecordSetImpl.java index 165abb2729492..0aa7d3f325234 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/TxtRecordSetImpl.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/TxtRecordSetImpl.java @@ -13,7 +13,10 @@ */ class TxtRecordSetImpl extends DnsRecordSetImpl - implements TxtRecordSet { + implements + TxtRecordSet, + TxtRecordSet.Definition, + TxtRecordSet.Update { TxtRecordSetImpl(final DnsZoneImpl parentDnsZone, final RecordSetInner innerModel, final RecordSetsInner client) { super(parentDnsZone, innerModel, client); } @@ -28,7 +31,33 @@ public List records() { @Override public TxtRecordSetImpl refresh() { - this.resetInner(); + this.refreshInner(); + return this; + } + + @Override + public TxtRecordSetImpl withText(String text) { + if (this.inner().txtRecords() == null) { + this.inner().withTxtRecords(new ArrayList()); + } + List value = new ArrayList<>(); + value.add(text); + this.inner().txtRecords().add(new TxtRecord().withValue(value)); + return this; + } + + @Override + public TxtRecordSetImpl withoutText(String text) { + if (this.inner().txtRecords() != null) { + for (TxtRecord record : this.inner().txtRecords()) { + if (record.value() != null && record.value().size() != 0) { + if (record.value().get(0).equalsIgnoreCase(text)) { + this.inner().txtRecords().remove(record); + break; + } + } + } + } return this; } From 93b4140b32d87974e563e7481bbd158135fc39f2 Mon Sep 17 00:00:00 2001 From: anuchan Date: Wed, 2 Nov 2016 15:52:21 -0700 Subject: [PATCH 7/7] adding recordsets impl types --- .../azure/management/dns/ARecordSets.java | 2 + .../azure/management/dns/AaaaRecordSets.java | 2 + .../azure/management/dns/CnameRecordSets.java | 2 + .../azure/management/dns/DnsRecordSets.java | 7 -- .../azure/management/dns/MxRecordSets.java | 2 + .../azure/management/dns/NsRecordSets.java | 2 + .../azure/management/dns/PtrRecordSets.java | 2 + .../azure/management/dns/SrvRecordSets.java | 2 + .../azure/management/dns/TxtRecordSets.java | 3 + .../dns/implementation/ARecordSetsImpl.java | 65 +++++++++++++++++++ .../implementation/AaaaRecordSetsImpl.java | 65 +++++++++++++++++++ .../implementation/CnameRecordSetsImpl.java | 65 +++++++++++++++++++ .../dns/implementation/DnsZoneImpl.java | 17 ++--- .../dns/implementation/MxRecordSetsImpl.java | 65 +++++++++++++++++++ .../dns/implementation/NsRecordSetsImpl.java | 65 +++++++++++++++++++ .../dns/implementation/PtrRecordSetsImpl.java | 65 +++++++++++++++++++ .../dns/implementation/SrvRecordSetsImpl.java | 65 +++++++++++++++++++ .../dns/implementation/TxtRecordSetsImpl.java | 65 +++++++++++++++++++ 18 files changed, 546 insertions(+), 15 deletions(-) create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/ARecordSetsImpl.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/AaaaRecordSetsImpl.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/CnameRecordSetsImpl.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/MxRecordSetsImpl.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/NsRecordSetsImpl.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/PtrRecordSetsImpl.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/SrvRecordSetsImpl.java create mode 100644 azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/TxtRecordSetsImpl.java diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/ARecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/ARecordSets.java index dbae95b48a512..6649613aab6c8 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/ARecordSets.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/ARecordSets.java @@ -2,6 +2,7 @@ import com.microsoft.azure.management.apigeneration.Fluent; import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingByName; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeletingById; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; @@ -13,6 +14,7 @@ public interface ARecordSets extends DnsRecordSets, SupportsListing, + SupportsGettingByName, SupportsGettingById, SupportsCreating, SupportsDeletingById { diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSets.java index e7d3236745b8f..65e9935b625c5 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSets.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/AaaaRecordSets.java @@ -2,6 +2,7 @@ import com.microsoft.azure.management.apigeneration.Fluent; import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingByName; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeletingById; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; @@ -13,6 +14,7 @@ public interface AaaaRecordSets extends DnsRecordSets, SupportsListing, + SupportsGettingByName, SupportsGettingById, SupportsCreating, SupportsDeletingById { diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSets.java index b5f1d7720830a..faa3c910eb7a7 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSets.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/CnameRecordSets.java @@ -2,6 +2,7 @@ import com.microsoft.azure.management.apigeneration.Fluent; import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingByName; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeletingById; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; @@ -13,6 +14,7 @@ public interface CnameRecordSets extends DnsRecordSets, SupportsListing, + SupportsGettingByName, SupportsGettingById, SupportsCreating, SupportsDeletingById { diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsRecordSets.java index 3fe3a5900ec25..3967a91c4f808 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsRecordSets.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/DnsRecordSets.java @@ -9,11 +9,4 @@ */ @Fluent public interface DnsRecordSets { - /** - * Gets the information about a Dns record set from Azure based on name. - * - * @param name the name of the record set - * @return the record set - */ - FluentRecordSetModelT getByName(String name); } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSets.java index 6a7aa036e2303..922267bdadcdf 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSets.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/MxRecordSets.java @@ -2,6 +2,7 @@ import com.microsoft.azure.management.apigeneration.Fluent; import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingByName; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeletingById; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; @@ -13,6 +14,7 @@ public interface MxRecordSets extends DnsRecordSets, SupportsListing, + SupportsGettingByName, SupportsGettingById, SupportsCreating, SupportsDeletingById { diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/NsRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/NsRecordSets.java index 66541056cb632..ddd96ca818f95 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/NsRecordSets.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/NsRecordSets.java @@ -2,6 +2,7 @@ import com.microsoft.azure.management.apigeneration.Fluent; import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingByName; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeletingById; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; @@ -13,6 +14,7 @@ public interface NsRecordSets extends DnsRecordSets, SupportsListing, + SupportsGettingByName, SupportsGettingById, SupportsCreating, SupportsDeletingById { diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/PtrRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/PtrRecordSets.java index 7e8fb2c1cfea2..a46cb2afae533 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/PtrRecordSets.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/PtrRecordSets.java @@ -2,6 +2,7 @@ import com.microsoft.azure.management.apigeneration.Fluent; import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingByName; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeletingById; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; @@ -13,6 +14,7 @@ public interface PtrRecordSets extends DnsRecordSets, SupportsListing, + SupportsGettingByName, SupportsGettingById, SupportsCreating, SupportsDeletingById { diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SrvRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SrvRecordSets.java index d3a3b7576da4d..f6de9cb271e86 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SrvRecordSets.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/SrvRecordSets.java @@ -2,6 +2,7 @@ import com.microsoft.azure.management.apigeneration.Fluent; import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingByName; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeletingById; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; @@ -13,6 +14,7 @@ public interface SrvRecordSets extends DnsRecordSets, SupportsListing, + SupportsGettingByName, SupportsGettingById, SupportsCreating, SupportsDeletingById { diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSets.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSets.java index d6b39a41be6a9..bd6a8ec97ef48 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSets.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/TxtRecordSets.java @@ -2,8 +2,10 @@ import com.microsoft.azure.management.apigeneration.Fluent; import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingByName; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeletingById; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeletingByName; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; /** @@ -13,6 +15,7 @@ public interface TxtRecordSets extends DnsRecordSets, SupportsListing, + SupportsGettingByName, SupportsGettingById, SupportsCreating, SupportsDeletingById { diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/ARecordSetsImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/ARecordSetsImpl.java new file mode 100644 index 0000000000000..0f45021d730bd --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/ARecordSetsImpl.java @@ -0,0 +1,65 @@ +package com.microsoft.azure.management.dns.implementation; + +import com.microsoft.azure.PagedList; +import com.microsoft.azure.management.dns.ARecordSet; +import com.microsoft.azure.management.dns.ARecordSets; +import com.microsoft.azure.management.dns.RecordType; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.CreatableWrappersImpl; +import rx.Observable; + +/** + * Implementation of {@link ARecordSets}. + */ +class ARecordSetsImpl + extends CreatableWrappersImpl + implements ARecordSets { + + private final DnsZoneImpl dnsZone; + private final RecordSetsInner client; + + ARecordSetsImpl(DnsZoneImpl dnsZone, RecordSetsInner client) { + this.dnsZone = dnsZone; + this.client = client; + } + + @Override + public ARecordSetImpl getByName(String name) { + RecordSetInner inner = this.client.get(this.dnsZone.resourceGroupName(), + this.dnsZone.name(), + name, + RecordType.A); + return new ARecordSetImpl(this.dnsZone, inner, this.client); + } + + @Override + public ARecordSetImpl getById(String id) { + return null; + } + + @Override + public ARecordSetImpl define(String name) { + return wrapModel(name); + } + + @Override + public Observable deleteByIdAsync(String id) { + return null; + } + + @Override + public PagedList list() { + return super.wrapList(this.client.listByType(this.dnsZone.resourceGroupName(), this.dnsZone.name(), RecordType.A)); + } + + @Override + protected ARecordSetImpl wrapModel(String name) { + RecordSetInner inner = new RecordSetInner(); + inner.withName(name).withType(RecordType.A.toString()); + return wrapModel(inner); + } + + @Override + protected ARecordSetImpl wrapModel(RecordSetInner inner) { + return new ARecordSetImpl(this.dnsZone, inner, this.client); + } +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/AaaaRecordSetsImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/AaaaRecordSetsImpl.java new file mode 100644 index 0000000000000..7ad682a1a7083 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/AaaaRecordSetsImpl.java @@ -0,0 +1,65 @@ +package com.microsoft.azure.management.dns.implementation; + +import com.microsoft.azure.PagedList; +import com.microsoft.azure.management.dns.AaaaRecordSet; +import com.microsoft.azure.management.dns.AaaaRecordSets; +import com.microsoft.azure.management.dns.RecordType; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.CreatableWrappersImpl; +import rx.Observable; + +/** + * Implementation of {@link AaaaRecordSets}. + */ +class AaaaRecordSetsImpl + extends CreatableWrappersImpl + implements AaaaRecordSets { + + private final DnsZoneImpl dnsZone; + private final RecordSetsInner client; + + AaaaRecordSetsImpl(DnsZoneImpl dnsZone, RecordSetsInner client) { + this.dnsZone = dnsZone; + this.client = client; + } + + @Override + public AaaaRecordSetImpl getByName(String name) { + RecordSetInner inner = this.client.get(this.dnsZone.resourceGroupName(), + this.dnsZone.name(), + name, + RecordType.AAAA); + return new AaaaRecordSetImpl(this.dnsZone, inner, this.client); + } + + @Override + public AaaaRecordSetImpl getById(String id) { + return null; + } + + @Override + public AaaaRecordSetImpl define(String name) { + return wrapModel(name); + } + + @Override + public Observable deleteByIdAsync(String id) { + return null; + } + + @Override + public PagedList list() { + return super.wrapList(this.client.listByType(this.dnsZone.resourceGroupName(), this.dnsZone.name(), RecordType.AAAA)); + } + + @Override + protected AaaaRecordSetImpl wrapModel(String name) { + RecordSetInner inner = new RecordSetInner(); + inner.withName(name).withType(RecordType.AAAA.toString()); + return wrapModel(inner); + } + + @Override + protected AaaaRecordSetImpl wrapModel(RecordSetInner inner) { + return new AaaaRecordSetImpl(this.dnsZone, inner, this.client); + } +} diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/CnameRecordSetsImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/CnameRecordSetsImpl.java new file mode 100644 index 0000000000000..2e33a5741eee0 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/CnameRecordSetsImpl.java @@ -0,0 +1,65 @@ +package com.microsoft.azure.management.dns.implementation; + +import com.microsoft.azure.PagedList; +import com.microsoft.azure.management.dns.CnameRecordSet; +import com.microsoft.azure.management.dns.CnameRecordSets; +import com.microsoft.azure.management.dns.RecordType; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.CreatableWrappersImpl; +import rx.Observable; + +/** + * Implementation of {@link CnameRecordSets}. + */ +class CnameRecordSetsImpl + extends CreatableWrappersImpl + implements CnameRecordSets { + + private final DnsZoneImpl dnsZone; + private final RecordSetsInner client; + + CnameRecordSetsImpl(DnsZoneImpl dnsZone, RecordSetsInner client) { + this.dnsZone = dnsZone; + this.client = client; + } + + @Override + public CnameRecordSet getByName(String name) { + RecordSetInner inner = this.client.get(this.dnsZone.resourceGroupName(), + this.dnsZone.name(), + name, + RecordType.CNAME); + return new CnameRecordSetImpl(this.dnsZone, inner, this.client); + } + + @Override + public CnameRecordSet getById(String id) { + return null; + } + + @Override + public CnameRecordSetImpl define(String name) { + return wrapModel(name); + } + + @Override + public Observable deleteByIdAsync(String id) { + return null; + } + + @Override + public PagedList list() { + return super.wrapList(this.client.listByType(this.dnsZone.resourceGroupName(), this.dnsZone.name(), RecordType.CNAME)); + } + + @Override + protected CnameRecordSetImpl wrapModel(String name) { + RecordSetInner inner = new RecordSetInner(); + inner.withName(name).withType(RecordType.CNAME.toString()); + return wrapModel(inner); + } + + @Override + protected CnameRecordSetImpl wrapModel(RecordSetInner inner) { + return new CnameRecordSetImpl(this.dnsZone, inner, this.client); + } +} \ No newline at end of file diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsZoneImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsZoneImpl.java index 23df5095a7b16..bc064a2fdc725 100644 --- a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsZoneImpl.java +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/DnsZoneImpl.java @@ -123,17 +123,18 @@ public Observable createResourceAsync() { public DnsZone refresh() { ZoneInner inner = this.innerCollection.get(this.resourceGroupName(), this.name()); this.setInner(inner); + this.initRecordSets(); return this; } private void initRecordSets() { - this.aRecordSets = null; - this.aaaaRecordSets = null; - this.cnameRecordSets = null; - this.mxRecordSets = null; - this.nsRecordSets = null; - this.ptrRecordSets = null; - this.srvRecordSets = null; - this.txtRecordSets = null; + this.aRecordSets = new ARecordSetsImpl(this, this.recordSetsClient); + this.aaaaRecordSets = new AaaaRecordSetsImpl(this, this.recordSetsClient); + this.cnameRecordSets = new CnameRecordSetsImpl(this, this.recordSetsClient); + this.mxRecordSets = new MxRecordSetsImpl(this, this.recordSetsClient); + this.nsRecordSets = new NsRecordSetsImpl(this, this.recordSetsClient); + this.ptrRecordSets = new PtrRecordSetsImpl(this, this.recordSetsClient); + this.srvRecordSets = new SrvRecordSetsImpl(this, this.recordSetsClient); + this.txtRecordSets = new TxtRecordSetsImpl(this, this.recordSetsClient); } } diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/MxRecordSetsImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/MxRecordSetsImpl.java new file mode 100644 index 0000000000000..651d686b316dd --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/MxRecordSetsImpl.java @@ -0,0 +1,65 @@ +package com.microsoft.azure.management.dns.implementation; + +import com.microsoft.azure.PagedList; +import com.microsoft.azure.management.dns.MxRecordSet; +import com.microsoft.azure.management.dns.MxRecordSets; +import com.microsoft.azure.management.dns.RecordType; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.CreatableWrappersImpl; +import rx.Observable; + +/** + * Implementation of {@link MxRecordSets}. + */ +class MxRecordSetsImpl + extends CreatableWrappersImpl + implements MxRecordSets { + + private final DnsZoneImpl dnsZone; + private final RecordSetsInner client; + + MxRecordSetsImpl(DnsZoneImpl dnsZone, RecordSetsInner client) { + this.dnsZone = dnsZone; + this.client = client; + } + + @Override + public MxRecordSetImpl getByName(String name) { + RecordSetInner inner = this.client.get(this.dnsZone.resourceGroupName(), + this.dnsZone.name(), + name, + RecordType.MX); + return new MxRecordSetImpl(this.dnsZone, inner, this.client); + } + + @Override + public MxRecordSetImpl getById(String id) { + return null; + } + + @Override + public MxRecordSetImpl define(String name) { + return wrapModel(name); + } + + @Override + public Observable deleteByIdAsync(String id) { + return null; + } + + @Override + public PagedList list() { + return super.wrapList(this.client.listByType(this.dnsZone.resourceGroupName(), this.dnsZone.name(), RecordType.MX)); + } + + @Override + protected MxRecordSetImpl wrapModel(String name) { + RecordSetInner inner = new RecordSetInner(); + inner.withName(name).withType(RecordType.MX.toString()); + return wrapModel(inner); + } + + @Override + protected MxRecordSetImpl wrapModel(RecordSetInner inner) { + return new MxRecordSetImpl(this.dnsZone, inner, this.client); + } +} \ No newline at end of file diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/NsRecordSetsImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/NsRecordSetsImpl.java new file mode 100644 index 0000000000000..97816df24fedc --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/NsRecordSetsImpl.java @@ -0,0 +1,65 @@ +package com.microsoft.azure.management.dns.implementation; + +import com.microsoft.azure.PagedList; +import com.microsoft.azure.management.dns.NsRecordSet; +import com.microsoft.azure.management.dns.NsRecordSets; +import com.microsoft.azure.management.dns.RecordType; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.CreatableWrappersImpl; +import rx.Observable; + +/** + * Implementation of {@link NsRecordSets}. + */ +class NsRecordSetsImpl + extends CreatableWrappersImpl + implements NsRecordSets { + + private final DnsZoneImpl dnsZone; + private final RecordSetsInner client; + + NsRecordSetsImpl(DnsZoneImpl dnsZone, RecordSetsInner client) { + this.dnsZone = dnsZone; + this.client = client; + } + + @Override + public NsRecordSetImpl getByName(String name) { + RecordSetInner inner = this.client.get(this.dnsZone.resourceGroupName(), + this.dnsZone.name(), + name, + RecordType.NS); + return new NsRecordSetImpl(this.dnsZone, inner, this.client); + } + + @Override + public NsRecordSetImpl getById(String id) { + return null; + } + + @Override + public NsRecordSetImpl define(String name) { + return wrapModel(name); + } + + @Override + public Observable deleteByIdAsync(String id) { + return null; + } + + @Override + public PagedList list() { + return super.wrapList(this.client.listByType(this.dnsZone.resourceGroupName(), this.dnsZone.name(), RecordType.NS)); + } + + @Override + protected NsRecordSetImpl wrapModel(String name) { + RecordSetInner inner = new RecordSetInner(); + inner.withName(name).withType(RecordType.NS.toString()); + return wrapModel(inner); + } + + @Override + protected NsRecordSetImpl wrapModel(RecordSetInner inner) { + return new NsRecordSetImpl(this.dnsZone, inner, this.client); + } +} \ No newline at end of file diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/PtrRecordSetsImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/PtrRecordSetsImpl.java new file mode 100644 index 0000000000000..f6f9762478f2d --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/PtrRecordSetsImpl.java @@ -0,0 +1,65 @@ +package com.microsoft.azure.management.dns.implementation; + +import com.microsoft.azure.PagedList; +import com.microsoft.azure.management.dns.PtrRecordSet; +import com.microsoft.azure.management.dns.PtrRecordSets; +import com.microsoft.azure.management.dns.RecordType; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.CreatableWrappersImpl; +import rx.Observable; + +/** + * Implementation of {@link PtrRecordSets}. + */ +class PtrRecordSetsImpl + extends CreatableWrappersImpl + implements PtrRecordSets { + + private final DnsZoneImpl dnsZone; + private final RecordSetsInner client; + + PtrRecordSetsImpl(DnsZoneImpl dnsZone, RecordSetsInner client) { + this.dnsZone = dnsZone; + this.client = client; + } + + @Override + public PtrRecordSetImpl getByName(String name) { + RecordSetInner inner = this.client.get(this.dnsZone.resourceGroupName(), + this.dnsZone.name(), + name, + RecordType.PTR); + return new PtrRecordSetImpl(this.dnsZone, inner, this.client); + } + + @Override + public PtrRecordSetImpl getById(String id) { + return null; + } + + @Override + public PtrRecordSetImpl define(String name) { + return wrapModel(name); + } + + @Override + public Observable deleteByIdAsync(String id) { + return null; + } + + @Override + public PagedList list() { + return super.wrapList(this.client.listByType(this.dnsZone.resourceGroupName(), this.dnsZone.name(), RecordType.PTR)); + } + + @Override + protected PtrRecordSetImpl wrapModel(String name) { + RecordSetInner inner = new RecordSetInner(); + inner.withName(name).withType(RecordType.PTR.toString()); + return wrapModel(inner); + } + + @Override + protected PtrRecordSetImpl wrapModel(RecordSetInner inner) { + return new PtrRecordSetImpl(this.dnsZone, inner, this.client); + } +} \ No newline at end of file diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/SrvRecordSetsImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/SrvRecordSetsImpl.java new file mode 100644 index 0000000000000..4f14daff0c27f --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/SrvRecordSetsImpl.java @@ -0,0 +1,65 @@ +package com.microsoft.azure.management.dns.implementation; + +import com.microsoft.azure.PagedList; +import com.microsoft.azure.management.dns.RecordType; +import com.microsoft.azure.management.dns.SrvRecordSet; +import com.microsoft.azure.management.dns.SrvRecordSets; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.CreatableWrappersImpl; +import rx.Observable; + +/** + * Implementation of {@link SrvRecordSets } + */ +class SrvRecordSetsImpl + extends CreatableWrappersImpl + implements SrvRecordSets { + + private final DnsZoneImpl dnsZone; + private final RecordSetsInner client; + + SrvRecordSetsImpl(DnsZoneImpl dnsZone, RecordSetsInner client) { + this.dnsZone = dnsZone; + this.client = client; + } + + @Override + public SrvRecordSetImpl getByName(String name) { + RecordSetInner inner = this.client.get(this.dnsZone.resourceGroupName(), + this.dnsZone.name(), + name, + RecordType.SRV); + return new SrvRecordSetImpl(this.dnsZone, inner, this.client); + } + + @Override + public SrvRecordSetImpl getById(String id) { + return null; + } + + @Override + public SrvRecordSetImpl define(String name) { + return wrapModel(name); + } + + @Override + public Observable deleteByIdAsync(String id) { + return null; + } + + @Override + public PagedList list() { + return super.wrapList(this.client.listByType(this.dnsZone.resourceGroupName(), this.dnsZone.name(), RecordType.SRV)); + } + + @Override + protected SrvRecordSetImpl wrapModel(String name) { + RecordSetInner inner = new RecordSetInner(); + inner.withName(name).withType(RecordType.SRV.toString()); + return wrapModel(inner); + } + + @Override + protected SrvRecordSetImpl wrapModel(RecordSetInner inner) { + return new SrvRecordSetImpl(this.dnsZone, inner, this.client); + } +} \ No newline at end of file diff --git a/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/TxtRecordSetsImpl.java b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/TxtRecordSetsImpl.java new file mode 100644 index 0000000000000..505e5c46d3879 --- /dev/null +++ b/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/implementation/TxtRecordSetsImpl.java @@ -0,0 +1,65 @@ +package com.microsoft.azure.management.dns.implementation; + +import com.microsoft.azure.PagedList; +import com.microsoft.azure.management.dns.RecordType; +import com.microsoft.azure.management.dns.TxtRecordSet; +import com.microsoft.azure.management.dns.TxtRecordSets; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.CreatableWrappersImpl; +import rx.Observable; + +/** + * Implementation of {@link TxtRecordSets}. + */ +class TxtRecordSetsImpl + extends CreatableWrappersImpl + implements TxtRecordSets { + + private final DnsZoneImpl dnsZone; + private final RecordSetsInner client; + + TxtRecordSetsImpl(DnsZoneImpl dnsZone, RecordSetsInner client) { + this.dnsZone = dnsZone; + this.client = client; + } + + @Override + public TxtRecordSetImpl getByName(String name) { + RecordSetInner inner = this.client.get(this.dnsZone.resourceGroupName(), + this.dnsZone.name(), + name, + RecordType.TXT); + return new TxtRecordSetImpl(this.dnsZone, inner, this.client); + } + + @Override + public TxtRecordSetImpl getById(String id) { + return null; + } + + @Override + public TxtRecordSetImpl define(String name) { + return wrapModel(name); + } + + @Override + public Observable deleteByIdAsync(String id) { + return null; + } + + @Override + public PagedList list() { + return super.wrapList(this.client.listByType(this.dnsZone.resourceGroupName(), this.dnsZone.name(), RecordType.TXT)); + } + + @Override + protected TxtRecordSetImpl wrapModel(String name) { + RecordSetInner inner = new RecordSetInner(); + inner.withName(name).withType(RecordType.TXT.toString()); + return wrapModel(inner); + } + + @Override + protected TxtRecordSetImpl wrapModel(RecordSetInner inner) { + return new TxtRecordSetImpl(this.dnsZone, inner, this.client); + } +} \ No newline at end of file