diff --git a/go.mod b/go.mod index 41126f5eb5e1..3bc390451767 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,7 @@ module github.com/hashicorp/terraform-provider-azurerm +replace github.com/hashicorp/go-azure-sdk/resource-manager => ../go-azure-sdk/resource-manager + require ( github.com/Azure/azure-sdk-for-go v66.0.0+incompatible github.com/Azure/go-autorest/autorest v0.11.29 @@ -17,7 +19,7 @@ require ( github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.6.0 github.com/hashicorp/go-azure-helpers v0.71.0 - github.com/hashicorp/go-azure-sdk/resource-manager v0.20241206.1180327 + github.com/hashicorp/go-azure-sdk/resource-manager v0.20241128.1112539 github.com/hashicorp/go-azure-sdk/sdk v0.20241206.1180327 github.com/hashicorp/go-hclog v1.6.3 github.com/hashicorp/go-multierror v1.1.1 diff --git a/go.sum b/go.sum index a578447b02af..aad163d0abce 100644 --- a/go.sum +++ b/go.sum @@ -94,8 +94,6 @@ github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-azure-helpers v0.71.0 h1:ra3aIRzg01g6MLKQ+yABcb6WJtrqRUDDgyuPLmyZ9lY= github.com/hashicorp/go-azure-helpers v0.71.0/go.mod h1:BmbF4JDYXK5sEmFeU5hcn8Br21uElcqLfdQxjatwQKw= -github.com/hashicorp/go-azure-sdk/resource-manager v0.20241206.1180327 h1:6b8IGRB1RpeFUtUym6bf+GJgyWuQpZq+fa/dBpHgPIE= -github.com/hashicorp/go-azure-sdk/resource-manager v0.20241206.1180327/go.mod h1:Y2T5KK4QAV+/tGfcwp5BzPRQs5/cbIXT/igtHqYZ09U= github.com/hashicorp/go-azure-sdk/sdk v0.20241206.1180327 h1:c7Y0wwTOdna2dndVW1nalZ/DZX1wDQCSj2JNgiLycKw= github.com/hashicorp/go-azure-sdk/sdk v0.20241206.1180327/go.mod h1:oI5R0fTbBx3K/sJBK5R/OlEy8ozdQjvctxVU9v3EDkc= github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= diff --git a/internal/clients/client.go b/internal/clients/client.go index d17804319dbf..56aa29c4b284 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -13,7 +13,7 @@ import ( analysisservices_v2017_08_01 "github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01" azurestackhci_v2024_01_01 "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2024-01-01" datadog_v2021_03_01 "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01" - dns_v2018_05_01 "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01" + dns_v2023_07_01_preview "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview" fluidrelay_2022_05_26 "github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26" hdinsight_v2021_06_01 "github.com/hashicorp/go-azure-sdk/resource-manager/hdinsight/2021-06-01" nginx_2024_11_01_preview "github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2024-11-01-preview" @@ -201,7 +201,7 @@ type Client struct { DesktopVirtualization *desktopvirtualization.Client DevTestLabs *devtestlabs.Client DigitalTwins *digitaltwins.Client - Dns *dns_v2018_05_01.Client + Dns *dns_v2023_07_01_preview.Client DomainServices *domainservices.Client Dynatrace *dynatrace.Client Elastic *elastic.Client diff --git a/internal/provider/services.go b/internal/provider/services.go index 6234b88e896b..8e5e45fa358f 100644 --- a/internal/provider/services.go +++ b/internal/provider/services.go @@ -168,6 +168,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration { dataprotection.Registration{}, desktopvirtualization.Registration{}, digitaltwins.Registration{}, + dns.Registration{}, domainservices.Registration{}, dynatrace.Registration{}, elasticsan.Registration{}, diff --git a/internal/services/dns/client/client.go b/internal/services/dns/client/client.go index 2b2d84655cc4..90d02663b783 100644 --- a/internal/services/dns/client/client.go +++ b/internal/services/dns/client/client.go @@ -4,7 +4,7 @@ package client import ( - dns_v2018_05_01 "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01" + dns_v2018_05_01 "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) diff --git a/internal/services/dns/dns_a_record_data_source.go b/internal/services/dns/dns_a_record_data_source.go index b7975e9a316d..8f89653cdaab 100644 --- a/internal/services/dns/dns_a_record_data_source.go +++ b/internal/services/dns/dns_a_record_data_source.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/internal/services/dns/dns_a_record_resource.go b/internal/services/dns/dns_a_record_resource.go index 5e4723205288..df40bc042bb6 100644 --- a/internal/services/dns/dns_a_record_resource.go +++ b/internal/services/dns/dns_a_record_resource.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/dns/dns_a_record_resource_test.go b/internal/services/dns/dns_a_record_resource_test.go index 6e2c6451fd90..60690190f7b7 100644 --- a/internal/services/dns/dns_a_record_resource_test.go +++ b/internal/services/dns/dns_a_record_resource_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/dns/dns_aaaa_record_data_source.go b/internal/services/dns/dns_aaaa_record_data_source.go index 3413043cd09a..39ef3adde597 100644 --- a/internal/services/dns/dns_aaaa_record_data_source.go +++ b/internal/services/dns/dns_aaaa_record_data_source.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/set" diff --git a/internal/services/dns/dns_aaaa_record_resource.go b/internal/services/dns/dns_aaaa_record_resource.go index 96eb71b3bc7f..191436fecc55 100644 --- a/internal/services/dns/dns_aaaa_record_resource.go +++ b/internal/services/dns/dns_aaaa_record_resource.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/dns/dns_aaaa_record_resource_test.go b/internal/services/dns/dns_aaaa_record_resource_test.go index 30eb5380902b..62078f0d494c 100644 --- a/internal/services/dns/dns_aaaa_record_resource_test.go +++ b/internal/services/dns/dns_aaaa_record_resource_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/dns/dns_caa_record_data_source.go b/internal/services/dns/dns_caa_record_data_source.go index 68bae55c5b8c..fcf8249afb28 100644 --- a/internal/services/dns/dns_caa_record_data_source.go +++ b/internal/services/dns/dns_caa_record_data_source.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/internal/services/dns/dns_caa_record_resource.go b/internal/services/dns/dns_caa_record_resource.go index 24f573412686..d0b21525e2be 100644 --- a/internal/services/dns/dns_caa_record_resource.go +++ b/internal/services/dns/dns_caa_record_resource.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/migration" diff --git a/internal/services/dns/dns_caa_record_resource_test.go b/internal/services/dns/dns_caa_record_resource_test.go index 5acdfcd0194e..e8c99dbcfa54 100644 --- a/internal/services/dns/dns_caa_record_resource_test.go +++ b/internal/services/dns/dns_caa_record_resource_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/dns/dns_cname_record_data_source.go b/internal/services/dns/dns_cname_record_data_source.go index e0bf316d828c..4e352e7d5389 100644 --- a/internal/services/dns/dns_cname_record_data_source.go +++ b/internal/services/dns/dns_cname_record_data_source.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/internal/services/dns/dns_cname_record_resource.go b/internal/services/dns/dns_cname_record_resource.go index 5f76a975ad73..83b3e62e3a7a 100644 --- a/internal/services/dns/dns_cname_record_resource.go +++ b/internal/services/dns/dns_cname_record_resource.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2022-04-01/endpoints" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" diff --git a/internal/services/dns/dns_cname_record_resource_test.go b/internal/services/dns/dns_cname_record_resource_test.go index ffcf8c99b9f6..0aca2d386be0 100644 --- a/internal/services/dns/dns_cname_record_resource_test.go +++ b/internal/services/dns/dns_cname_record_resource_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/dns/dns_ds_record_data_source.go b/internal/services/dns/dns_ds_record_data_source.go new file mode 100644 index 000000000000..5c4f7dee8083 --- /dev/null +++ b/internal/services/dns/dns_ds_record_data_source.go @@ -0,0 +1,145 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package dns + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var _ sdk.DataSource = DnsDSRecordDataResource{} + +type DnsDSRecordDataResource struct{} + +func (DnsDSRecordDataResource) ModelObject() interface{} { + return &DnsDSRecordDataSourceModel{} +} + +func (d DnsDSRecordDataResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return validate.ValidateRecordTypeID(recordsets.RecordTypeDS) +} + +func (DnsDSRecordDataResource) ResourceType() string { + return "azurerm_dns_ds_record" +} + +type DnsDSRecordDataSourceModel struct { + Name string `tfschema:"name"` + ZoneId string `tfschema:"dns_zone_id"` + Ttl int64 `tfschema:"ttl"` + Record []DnsDSRecordResourceRecord `tfschema:"record"` + Tags map[string]string `tfschema:"tags"` + Fqdn string `tfschema:"fqdn"` +} + +func (DnsDSRecordDataResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "dns_zone_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: zones.ValidateDnsZoneID, + }, + } +} + +func (DnsDSRecordDataResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "record": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "algorithm": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "key_tag": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "digest_type": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "digest_value": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + } +} + +func (DnsDSRecordDataResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Dns.RecordSets + subscriptionId := metadata.Client.Account.SubscriptionId + + var state DnsDSRecordDataSourceModel + if err := metadata.Decode(&state); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + zoneId, err := zones.ParseDnsZoneID(state.ZoneId) + if err != nil { + return fmt.Errorf("parsing dns_zone_id: %+v", err) + } + id := recordsets.NewRecordTypeID(subscriptionId, zoneId.ResourceGroupName, zoneId.DnsZoneName, recordsets.RecordTypeDS, state.Name) + + resp, err := client.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + state.Ttl = pointer.From(props.TTL) + state.Fqdn = pointer.From(props.Fqdn) + + state.Record = flattenDnsDSRecords(props.DSRecords) + + state.Tags = pointer.From(props.Metadata) + } + } + metadata.SetID(id) + + return metadata.Encode(&state) + }, + } +} diff --git a/internal/services/dns/dns_ds_record_data_source_test.go b/internal/services/dns/dns_ds_record_data_source_test.go new file mode 100644 index 000000000000..fa1e670daea9 --- /dev/null +++ b/internal/services/dns/dns_ds_record_data_source_test.go @@ -0,0 +1,44 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package dns_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type DnsDSRecordDataSource struct{} + +func TestAccDataSourceDnsDSRecord_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_dns_ds_record", "test") + r := DnsDSRecordDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("name").Exists(), + check.That(data.ResourceName).Key("dns_zone_id").Exists(), + check.That(data.ResourceName).Key("record.#").HasValue("2"), + check.That(data.ResourceName).Key("ttl").Exists(), + check.That(data.ResourceName).Key("fqdn").Exists(), + check.That(data.ResourceName).Key("tags.%").HasValue("0"), + ), + }, + }) +} + +func (DnsDSRecordDataSource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +data "azurerm_dns_ds_record" "test" { + name = azurerm_dns_ds_record.test.name + dns_zone_id = azurerm_dns_zone.test.id +} +`, DnsDSRecordResource{}.basic(data)) +} diff --git a/internal/services/dns/dns_ds_record_resource.go b/internal/services/dns/dns_ds_record_resource.go new file mode 100644 index 000000000000..5a9a0aa1fce1 --- /dev/null +++ b/internal/services/dns/dns_ds_record_resource.go @@ -0,0 +1,314 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package dns + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var ( + _ sdk.Resource = DnsDSRecordResource{} + _ sdk.ResourceWithUpdate = DnsDSRecordResource{} +) + +type DnsDSRecordResource struct{} + +func (DnsDSRecordResource) ModelObject() interface{} { + return &DnsDSRecordResourceModel{} +} + +func (DnsDSRecordResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return validate.ValidateRecordTypeID(recordsets.RecordTypeDS) +} + +func (DnsDSRecordResource) ResourceType() string { + return "azurerm_dns_ds_record" +} + +type DnsDSRecordResourceModel struct { + Name string `tfschema:"name"` + ZoneId string `tfschema:"dns_zone_id"` + Ttl int64 `tfschema:"ttl"` + Record []DnsDSRecordResourceRecord `tfschema:"record"` + Tags map[string]string `tfschema:"tags"` + Fqdn string `tfschema:"fqdn"` +} + +type DnsDSRecordResourceRecord struct { + Algorithm int64 `tfschema:"algorithm"` + KeyTag int64 `tfschema:"key_tag"` + DigestType int64 `tfschema:"digest_type"` + DigestValue string `tfschema:"digest_value"` +} + +func (DnsDSRecordResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "dns_zone_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: zones.ValidateDnsZoneID, + }, + + "record": { + Type: pluginsdk.TypeSet, + Required: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "algorithm": { + Type: pluginsdk.TypeInt, + Required: true, + }, + + "key_tag": { + Type: pluginsdk.TypeInt, + Required: true, + }, + + "digest_type": { + Type: pluginsdk.TypeInt, + Required: true, + }, + + "digest_value": { + Type: pluginsdk.TypeString, + Required: true, + }, + }, + }, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Required: true, + }, + + "tags": commonschema.Tags(), + } +} + +func (DnsDSRecordResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + } +} + +func (r DnsDSRecordResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Dns.RecordSets + subscriptionId := metadata.Client.Account.SubscriptionId + + var model DnsDSRecordResourceModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + zoneId, err := zones.ParseDnsZoneID(model.ZoneId) + if err != nil { + return fmt.Errorf("parsing dns_zone_id: %+v", err) + } + id := recordsets.NewRecordTypeID(subscriptionId, zoneId.ResourceGroupName, zoneId.DnsZoneName, recordsets.RecordTypeDS, model.Name) + + existing, err := client.Get(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + parameters := recordsets.RecordSet{ + Name: pointer.To(model.Name), + Properties: &recordsets.RecordSetProperties{ + Metadata: pointer.To(model.Tags), + TTL: pointer.To(model.Ttl), + DSRecords: expandDnsDSRecords(model.Record), + }, + } + + if _, err := client.CreateOrUpdate(ctx, id, parameters, recordsets.DefaultCreateOrUpdateOperationOptions()); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + + return nil + }, + } +} + +func (DnsDSRecordResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Dns.RecordSets + + state := DnsDSRecordResourceModel{} + + id, err := recordsets.ParseRecordTypeID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + zoneId := zones.NewDnsZoneID(id.SubscriptionId, id.ResourceGroupName, id.DnsZoneName) + state.Name = id.RelativeRecordSetName + state.ZoneId = zoneId.ID() + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + state.Ttl = pointer.From(props.TTL) + state.Fqdn = pointer.From(props.Fqdn) + + state.Record = flattenDnsDSRecords(props.DSRecords) + + state.Tags = pointer.From(props.Metadata) + } + } + + return metadata.Encode(&state) + }, + } +} + +func (DnsDSRecordResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Dns.RecordSets + + var model DnsDSRecordResourceModel + + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + id, err := recordsets.ParseRecordTypeID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + existing, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + if existing.Model == nil { + return fmt.Errorf("retrieving %s: `model` was nil", id) + } + + if existing.Model.Properties == nil { + return fmt.Errorf("retrieving %s: `properties` was nil", id) + } + + payload := *existing.Model + + if metadata.ResourceData.HasChange("record") { + payload.Properties.DSRecords = expandDnsDSRecords(model.Record) + } + + if metadata.ResourceData.HasChange("ttl") { + payload.Properties.TTL = pointer.To(model.Ttl) + } + + if metadata.ResourceData.HasChange("tags") { + payload.Properties.Metadata = pointer.To(model.Tags) + } + + if _, err := client.CreateOrUpdate(ctx, *id, payload, recordsets.DefaultCreateOrUpdateOperationOptions()); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + + return nil + }, + } +} + +func (DnsDSRecordResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Dns.RecordSets + + id, err := recordsets.ParseRecordTypeID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if _, err := client.Delete(ctx, *id, recordsets.DefaultDeleteOperationOptions()); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} + +func flattenDnsDSRecords(records *[]recordsets.DsRecord) []DnsDSRecordResourceRecord { + results := make([]DnsDSRecordResourceRecord, 0) + + if records != nil { + for _, record := range *records { + result := DnsDSRecordResourceRecord{ + Algorithm: pointer.From(record.Algorithm), + KeyTag: pointer.From(record.KeyTag), + } + + if record.Digest != nil { + result.DigestType = pointer.From(record.Digest.AlgorithmType) + result.DigestValue = pointer.From(record.Digest.Value) + } + results = append(results, result) + } + } + + return results +} + +func expandDnsDSRecords(d []DnsDSRecordResourceRecord) *[]recordsets.DsRecord { + records := make([]recordsets.DsRecord, 0) + + for _, v := range d { + records = append(records, recordsets.DsRecord{ + Algorithm: pointer.To(v.Algorithm), + KeyTag: pointer.To(v.KeyTag), + Digest: &recordsets.Digest{ + AlgorithmType: pointer.To(v.DigestType), + Value: pointer.To(v.DigestValue), + }, + }) + } + + return &records +} diff --git a/internal/services/dns/dns_ds_record_resource_test.go b/internal/services/dns/dns_ds_record_resource_test.go new file mode 100644 index 000000000000..1c96ed46550a --- /dev/null +++ b/internal/services/dns/dns_ds_record_resource_test.go @@ -0,0 +1,306 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package dns_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type DnsDSRecordResource struct{} + +func TestAccDnsDSRecord_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_dns_ds_record", "test") + r := DnsDSRecordResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("fqdn").Exists(), + ), + }, + data.ImportStep(), + }) +} + +func TestAccDnsDSRecord_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_dns_ds_record", "test") + r := DnsDSRecordResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccDnsDSRecord_updateRecords(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_dns_ds_record", "test") + r := DnsDSRecordResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("record.#").HasValue("2"), + ), + }, + data.ImportStep(), + { + Config: r.updateRecords(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("record.#").HasValue("3"), + ), + }, + data.ImportStep(), + }) +} + +func TestAccDnsDSRecord_withTags(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_dns_ds_record", "test") + r := DnsDSRecordResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withTags(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("tags.%").HasValue("2"), + ), + }, + data.ImportStep(), + { + Config: r.withTagsUpdate(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("tags.%").HasValue("1"), + ), + }, + data.ImportStep(), + }) +} + +func (DnsDSRecordResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := recordsets.ParseRecordTypeID(state.ID) + if err != nil { + return nil, err + } + + resp, err := clients.Dns.RecordSets.Get(ctx, *id) + if err != nil { + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) + } + + return pointer.To(resp.Model != nil), nil +} + +func (DnsDSRecordResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dns_zone" "test" { + name = "acctestzone%d.com" + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_dns_ds_record" "test" { + name = "myarecord%d" + dns_zone_id = azurerm_dns_zone.test.id + ttl = 300 + + record { + algorithm = 13 + key_tag = 28237 + digest_type = 2 + digest_value = "40F628643831D5EAF7D005D3237DE32F3F37AE6025C7891D202B0BAFA9924778" + } + + record { + algorithm = 13 + key_tag = 46872 + digest_type = 2 + digest_value = "2C0BAC20EB5C8C315694CBEB62E56C71CDC0069D058A8B80992E6499D91DD247" + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) +} + +func (r DnsDSRecordResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_dns_ds_record" "import" { + name = azurerm_dns_ds_record.test.name + dns_zone_id = azurerm_dns_zone.test.id + ttl = 300 + + record { + algorithm = 13 + key_tag = 28237 + digest_type = 2 + digest_value = "40F628643831D5EAF7D005D3237DE32F3F37AE6025C7891D202B0BAFA9924778" + } + + record { + algorithm = 13 + key_tag = 46872 + digest_type = 2 + digest_value = "2C0BAC20EB5C8C315694CBEB62E56C71CDC0069D058A8B80992E6499D91DD247" + } +} +`, r.basic(data)) +} + +func (DnsDSRecordResource) updateRecords(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dns_zone" "test" { + name = "acctestzone%d.com" + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_dns_ds_record" "test" { + name = "myarecord%d" + dns_zone_id = azurerm_dns_zone.test.id + ttl = 300 + + record { + algorithm = 13 + key_tag = 28237 + digest_type = 2 + digest_value = "40F628643831D5EAF7D005D3237DE32F3F37AE6025C7891D202B0BAFA9924778" + } + + record { + algorithm = 13 + key_tag = 46872 + digest_type = 2 + digest_value = "2C0BAC20EB5C8C315694CBEB62E56C71CDC0069D058A8B80992E6499D91DD247" + } + + record { + algorithm = 13 + key_tag = 20795 + digest_type = 2 + digest_value = "55E20DB8044B0C6190A925598F08F8146C9A0D4F668F8CA5A7276EB54064C5E3" + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) +} + +func (DnsDSRecordResource) withTags(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dns_zone" "test" { + name = "acctestzone%d.com" + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_dns_ds_record" "test" { + name = "myarecord%d" + dns_zone_id = azurerm_dns_zone.test.id + ttl = 300 + + record { + algorithm = 13 + key_tag = 28237 + digest_type = 2 + digest_value = "40F628643831D5EAF7D005D3237DE32F3F37AE6025C7891D202B0BAFA9924778" + } + + record { + algorithm = 13 + key_tag = 46872 + digest_type = 2 + digest_value = "2C0BAC20EB5C8C315694CBEB62E56C71CDC0069D058A8B80992E6499D91DD247" + } + + tags = { + environment = "Production" + cost_center = "MSFT" + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) +} + +func (DnsDSRecordResource) withTagsUpdate(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dns_zone" "test" { + name = "acctestzone%d.com" + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_dns_ds_record" "test" { + name = "myarecord%d" + dns_zone_id = azurerm_dns_zone.test.id + ttl = 300 + + record { + algorithm = 13 + key_tag = 28237 + digest_type = 2 + digest_value = "40F628643831D5EAF7D005D3237DE32F3F37AE6025C7891D202B0BAFA9924778" + } + + record { + algorithm = 13 + key_tag = 46872 + digest_type = 2 + digest_value = "2C0BAC20EB5C8C315694CBEB62E56C71CDC0069D058A8B80992E6499D91DD247" + } + + tags = { + environment = "staging" + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) +} diff --git a/internal/services/dns/dns_mx_record_data_source.go b/internal/services/dns/dns_mx_record_data_source.go index 2552771099ae..cbed97a22356 100644 --- a/internal/services/dns/dns_mx_record_data_source.go +++ b/internal/services/dns/dns_mx_record_data_source.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/internal/services/dns/dns_mx_record_resource.go b/internal/services/dns/dns_mx_record_resource.go index 0d6c77990d9c..25b3094c1318 100644 --- a/internal/services/dns/dns_mx_record_resource.go +++ b/internal/services/dns/dns_mx_record_resource.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/migration" diff --git a/internal/services/dns/dns_mx_record_resource_test.go b/internal/services/dns/dns_mx_record_resource_test.go index 8cc71531fb41..aedd3459f7ea 100644 --- a/internal/services/dns/dns_mx_record_resource_test.go +++ b/internal/services/dns/dns_mx_record_resource_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/dns/dns_ns_record_data_source.go b/internal/services/dns/dns_ns_record_data_source.go index f99d4ecc1729..aa1b8b182c90 100644 --- a/internal/services/dns/dns_ns_record_data_source.go +++ b/internal/services/dns/dns_ns_record_data_source.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/internal/services/dns/dns_ns_record_resource.go b/internal/services/dns/dns_ns_record_resource.go index d3033c1e53e3..9d568041f7c9 100644 --- a/internal/services/dns/dns_ns_record_resource.go +++ b/internal/services/dns/dns_ns_record_resource.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/migration" diff --git a/internal/services/dns/dns_ns_record_resource_test.go b/internal/services/dns/dns_ns_record_resource_test.go index 2267b9acffed..8ec4086cde68 100644 --- a/internal/services/dns/dns_ns_record_resource_test.go +++ b/internal/services/dns/dns_ns_record_resource_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/dns/dns_ptr_record_data_source.go b/internal/services/dns/dns_ptr_record_data_source.go index be66525ca868..35b6bbc626bc 100644 --- a/internal/services/dns/dns_ptr_record_data_source.go +++ b/internal/services/dns/dns_ptr_record_data_source.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/internal/services/dns/dns_ptr_record_resource.go b/internal/services/dns/dns_ptr_record_resource.go index 7af80249b9b1..269ff38ad0bf 100644 --- a/internal/services/dns/dns_ptr_record_resource.go +++ b/internal/services/dns/dns_ptr_record_resource.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/migration" diff --git a/internal/services/dns/dns_ptr_record_resource_test.go b/internal/services/dns/dns_ptr_record_resource_test.go index e4186afe35a8..e331f7944dfb 100644 --- a/internal/services/dns/dns_ptr_record_resource_test.go +++ b/internal/services/dns/dns_ptr_record_resource_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/dns/dns_soa_record_data_source.go b/internal/services/dns/dns_soa_record_data_source.go index b71f63f4ffb5..2d715f955f02 100644 --- a/internal/services/dns/dns_soa_record_data_source.go +++ b/internal/services/dns/dns_soa_record_data_source.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/internal/services/dns/dns_srv_record_data_source.go b/internal/services/dns/dns_srv_record_data_source.go index 2d9bedde1c4e..e75d1cff4cb2 100644 --- a/internal/services/dns/dns_srv_record_data_source.go +++ b/internal/services/dns/dns_srv_record_data_source.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/internal/services/dns/dns_srv_record_resource.go b/internal/services/dns/dns_srv_record_resource.go index 323071b0fc33..0bc90c48f53e 100644 --- a/internal/services/dns/dns_srv_record_resource.go +++ b/internal/services/dns/dns_srv_record_resource.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/migration" diff --git a/internal/services/dns/dns_srv_record_resource_test.go b/internal/services/dns/dns_srv_record_resource_test.go index 062458ea8aae..65bc520909e7 100644 --- a/internal/services/dns/dns_srv_record_resource_test.go +++ b/internal/services/dns/dns_srv_record_resource_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/dns/dns_tlsa_record_data_source.go b/internal/services/dns/dns_tlsa_record_data_source.go new file mode 100644 index 000000000000..a5eac60ab736 --- /dev/null +++ b/internal/services/dns/dns_tlsa_record_data_source.go @@ -0,0 +1,145 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package dns + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var _ sdk.DataSource = DnsTLSARecordDataResource{} + +type DnsTLSARecordDataResource struct{} + +func (DnsTLSARecordDataResource) ModelObject() interface{} { + return &DnsTLSARecordDataSourceModel{} +} + +func (d DnsTLSARecordDataResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return validate.ValidateRecordTypeID(recordsets.RecordTypeTLSA) +} + +func (DnsTLSARecordDataResource) ResourceType() string { + return "azurerm_dns_tlsa_record" +} + +type DnsTLSARecordDataSourceModel struct { + Name string `tfschema:"name"` + ZoneId string `tfschema:"dns_zone_id"` + Ttl int64 `tfschema:"ttl"` + Record []DnsTLSARecordResourceRecord `tfschema:"record"` + Tags map[string]string `tfschema:"tags"` + Fqdn string `tfschema:"fqdn"` +} + +func (DnsTLSARecordDataResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "dns_zone_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: zones.ValidateDnsZoneID, + }, + } +} + +func (DnsTLSARecordDataResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "record": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "matching_type": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "selector": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "usage": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "certificate_association_data": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + } +} + +func (DnsTLSARecordDataResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Dns.RecordSets + subscriptionId := metadata.Client.Account.SubscriptionId + + var state DnsTLSARecordDataSourceModel + if err := metadata.Decode(&state); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + zoneId, err := zones.ParseDnsZoneID(state.ZoneId) + if err != nil { + return fmt.Errorf("parsing dns_zone_id: %+v", err) + } + id := recordsets.NewRecordTypeID(subscriptionId, zoneId.ResourceGroupName, zoneId.DnsZoneName, recordsets.RecordTypeTLSA, state.Name) + + resp, err := client.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + state.Ttl = pointer.From(props.TTL) + state.Fqdn = pointer.From(props.Fqdn) + + state.Record = flattenDnsTLSARecords(props.TLSARecords) + + state.Tags = pointer.From(props.Metadata) + } + } + metadata.SetID(id) + + return metadata.Encode(&state) + }, + } +} diff --git a/internal/services/dns/dns_tlsa_record_data_source_test.go b/internal/services/dns/dns_tlsa_record_data_source_test.go new file mode 100644 index 000000000000..1c49c2bff052 --- /dev/null +++ b/internal/services/dns/dns_tlsa_record_data_source_test.go @@ -0,0 +1,44 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package dns_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type DnsTLSARecordDataSource struct{} + +func TestAccDataSourceDnsTLSARecord_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_dns_tlsa_record", "test") + r := DnsTLSARecordDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("name").Exists(), + check.That(data.ResourceName).Key("dns_zone_id").Exists(), + check.That(data.ResourceName).Key("record.#").HasValue("2"), + check.That(data.ResourceName).Key("ttl").Exists(), + check.That(data.ResourceName).Key("fqdn").Exists(), + check.That(data.ResourceName).Key("tags.%").HasValue("0"), + ), + }, + }) +} + +func (DnsTLSARecordDataSource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +data "azurerm_dns_tlsa_record" "test" { + name = azurerm_dns_tlsa_record.test.name + dns_zone_id = azurerm_dns_zone.test.id +} +`, DnsTLSARecordResource{}.basic(data)) +} diff --git a/internal/services/dns/dns_tlsa_record_resource.go b/internal/services/dns/dns_tlsa_record_resource.go new file mode 100644 index 000000000000..eecff198fbb3 --- /dev/null +++ b/internal/services/dns/dns_tlsa_record_resource.go @@ -0,0 +1,309 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package dns + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var ( + _ sdk.Resource = DnsTLSARecordResource{} + _ sdk.ResourceWithUpdate = DnsTLSARecordResource{} +) + +type DnsTLSARecordResource struct{} + +func (DnsTLSARecordResource) ModelObject() interface{} { + return &DnsTLSARecordResourceModel{} +} + +func (DnsTLSARecordResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return validate.ValidateRecordTypeID(recordsets.RecordTypeTLSA) +} + +func (DnsTLSARecordResource) ResourceType() string { + return "azurerm_dns_tlsa_record" +} + +type DnsTLSARecordResourceModel struct { + Name string `tfschema:"name"` + ZoneId string `tfschema:"dns_zone_id"` + Ttl int64 `tfschema:"ttl"` + Record []DnsTLSARecordResourceRecord `tfschema:"record"` + Tags map[string]string `tfschema:"tags"` + Fqdn string `tfschema:"fqdn"` +} + +type DnsTLSARecordResourceRecord struct { + MatchingType int64 `tfschema:"matching_type"` + Selector int64 `tfschema:"selector"` + Usage int64 `tfschema:"usage"` + CertAssociationData string `tfschema:"certificate_association_data"` +} + +func (DnsTLSARecordResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "dns_zone_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: zones.ValidateDnsZoneID, + }, + + "record": { + Type: pluginsdk.TypeSet, + Required: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "matching_type": { + Type: pluginsdk.TypeInt, + Required: true, + }, + + "selector": { + Type: pluginsdk.TypeInt, + Required: true, + }, + + "usage": { + Type: pluginsdk.TypeInt, + Required: true, + }, + + "certificate_association_data": { + Type: pluginsdk.TypeString, + Required: true, + }, + }, + }, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Required: true, + }, + + "tags": commonschema.Tags(), + } +} + +func (DnsTLSARecordResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + } +} + +func (r DnsTLSARecordResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Dns.RecordSets + subscriptionId := metadata.Client.Account.SubscriptionId + + var model DnsTLSARecordResourceModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + zoneId, err := zones.ParseDnsZoneID(model.ZoneId) + if err != nil { + return fmt.Errorf("parsing dns_zone_id: %+v", err) + } + + id := recordsets.NewRecordTypeID(subscriptionId, zoneId.ResourceGroupName, zoneId.DnsZoneName, recordsets.RecordTypeTLSA, model.Name) + + existing, err := client.Get(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + parameters := recordsets.RecordSet{ + Name: pointer.To(model.Name), + Properties: &recordsets.RecordSetProperties{ + Metadata: pointer.To(model.Tags), + TTL: pointer.To(model.Ttl), + TLSARecords: expandDnsTLSARecords(model.Record), + }, + } + + if _, err := client.CreateOrUpdate(ctx, id, parameters, recordsets.DefaultCreateOrUpdateOperationOptions()); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + + return nil + }, + } +} + +func (DnsTLSARecordResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Dns.RecordSets + + state := DnsTLSARecordResourceModel{} + + id, err := recordsets.ParseRecordTypeID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + zoneId := zones.NewDnsZoneID(id.SubscriptionId, id.ResourceGroupName, id.DnsZoneName) + state.Name = id.RelativeRecordSetName + state.ZoneId = zoneId.ID() + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + state.Ttl = pointer.From(props.TTL) + state.Fqdn = pointer.From(props.Fqdn) + + state.Record = flattenDnsTLSARecords(props.TLSARecords) + + state.Tags = pointer.From(props.Metadata) + } + } + + return metadata.Encode(&state) + }, + } +} + +func (DnsTLSARecordResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Dns.RecordSets + + var model DnsTLSARecordResourceModel + + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + id, err := recordsets.ParseRecordTypeID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + existing, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + if existing.Model == nil { + return fmt.Errorf("retrieving %s: `model` was nil", id) + } + + if existing.Model.Properties == nil { + return fmt.Errorf("retrieving %s: `properties` was nil", id) + } + + payload := *existing.Model + + if metadata.ResourceData.HasChange("record") { + payload.Properties.TLSARecords = expandDnsTLSARecords(model.Record) + } + + if metadata.ResourceData.HasChange("ttl") { + payload.Properties.TTL = pointer.To(model.Ttl) + } + + if metadata.ResourceData.HasChange("tags") { + payload.Properties.Metadata = pointer.To(model.Tags) + } + + if _, err := client.CreateOrUpdate(ctx, *id, payload, recordsets.DefaultCreateOrUpdateOperationOptions()); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + + return nil + }, + } +} + +func (DnsTLSARecordResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Dns.RecordSets + + id, err := recordsets.ParseRecordTypeID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if _, err := client.Delete(ctx, *id, recordsets.DefaultDeleteOperationOptions()); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} + +func flattenDnsTLSARecords(records *[]recordsets.TlsaRecord) []DnsTLSARecordResourceRecord { + results := make([]DnsTLSARecordResourceRecord, 0) + + if records != nil { + for _, record := range *records { + results = append(results, DnsTLSARecordResourceRecord{ + MatchingType: pointer.From(record.MatchingType), + Selector: pointer.From(record.Selector), + Usage: pointer.From(record.Usage), + CertAssociationData: pointer.From(record.CertAssociationData), + }) + } + } + + return results +} + +func expandDnsTLSARecords(d []DnsTLSARecordResourceRecord) *[]recordsets.TlsaRecord { + records := make([]recordsets.TlsaRecord, 0) + + for _, v := range d { + records = append(records, recordsets.TlsaRecord{ + MatchingType: pointer.To(v.MatchingType), + Selector: pointer.To(v.Selector), + Usage: pointer.To(v.Usage), + CertAssociationData: pointer.To(v.CertAssociationData), + }) + } + + return &records +} diff --git a/internal/services/dns/dns_tlsa_record_resource_test.go b/internal/services/dns/dns_tlsa_record_resource_test.go new file mode 100644 index 000000000000..7f3f7810bfce --- /dev/null +++ b/internal/services/dns/dns_tlsa_record_resource_test.go @@ -0,0 +1,306 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package dns_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type DnsTLSARecordResource struct{} + +func TestAccDnsTLSARecord_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_dns_tlsa_record", "test") + r := DnsTLSARecordResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("fqdn").Exists(), + ), + }, + data.ImportStep(), + }) +} + +func TestAccDnsTLSARecord_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_dns_tlsa_record", "test") + r := DnsTLSARecordResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccDnsTLSARecord_updateRecords(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_dns_tlsa_record", "test") + r := DnsTLSARecordResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("record.#").HasValue("2"), + ), + }, + data.ImportStep(), + { + Config: r.updateRecords(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("record.#").HasValue("3"), + ), + }, + data.ImportStep(), + }) +} + +func TestAccDnsTLSARecord_withTags(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_dns_tlsa_record", "test") + r := DnsTLSARecordResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withTags(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("tags.%").HasValue("2"), + ), + }, + data.ImportStep(), + { + Config: r.withTagsUpdate(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("tags.%").HasValue("1"), + ), + }, + data.ImportStep(), + }) +} + +func (DnsTLSARecordResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := recordsets.ParseRecordTypeID(state.ID) + if err != nil { + return nil, err + } + + resp, err := clients.Dns.RecordSets.Get(ctx, *id) + if err != nil { + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) + } + + return pointer.To(resp.Model != nil), nil +} + +func (DnsTLSARecordResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dns_zone" "test" { + name = "acctestzone%d.com" + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_dns_tlsa_record" "test" { + name = "myarecord%d" + dns_zone_id = azurerm_dns_zone.test.id + ttl = 300 + + record { + matching_type = 1 + selector = 1 + usage = 3 + certificate_association_data = "370C66FD4A0673CE1B62E76B819835DABB20702E4497CB10AFFE46E8135381E7" + } + + record { + matching_type = 1 + selector = 0 + usage = 0 + certificate_association_data = "d2abde240d7cd3ee6b4b28c54df034b97983a1d16e8a410e4561cb106618e971" + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) +} + +func (r DnsTLSARecordResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_dns_tlsa_record" "import" { + name = azurerm_dns_tlsa_record.test.name + dns_zone_id = azurerm_dns_zone.test.id + ttl = 300 + + record { + matching_type = 1 + selector = 1 + usage = 3 + certificate_association_data = "370C66FD4A0673CE1B62E76B819835DABB20702E4497CB10AFFE46E8135381E7" + } + + record { + matching_type = 1 + selector = 0 + usage = 0 + certificate_association_data = "d2abde240d7cd3ee6b4b28c54df034b97983a1d16e8a410e4561cb106618e971" + } +} +`, r.basic(data)) +} + +func (DnsTLSARecordResource) updateRecords(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dns_zone" "test" { + name = "acctestzone%d.com" + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_dns_tlsa_record" "test" { + name = "myarecord%d" + dns_zone_id = azurerm_dns_zone.test.id + ttl = 300 + + record { + matching_type = 1 + selector = 1 + usage = 3 + certificate_association_data = "370C66FD4A0673CE1B62E76B819835DABB20702E4497CB10AFFE46E8135381E7" + } + + record { + matching_type = 1 + selector = 0 + usage = 0 + certificate_association_data = "d2abde240d7cd3ee6b4b28c54df034b97983a1d16e8a410e4561cb106618e971" + } + + record { + matching_type = 1 + selector = 1 + usage = 3 + certificate_association_data = "0C72AC70B745AC19998811B131D662C9AC69DBDBE7CB23E5B514B56664C5D3D6" + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) +} + +func (DnsTLSARecordResource) withTags(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dns_zone" "test" { + name = "acctestzone%d.com" + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_dns_tlsa_record" "test" { + name = "myarecord%d" + dns_zone_id = azurerm_dns_zone.test.id + ttl = 300 + + record { + matching_type = 1 + selector = 1 + usage = 3 + certificate_association_data = "370C66FD4A0673CE1B62E76B819835DABB20702E4497CB10AFFE46E8135381E7" + } + + record { + matching_type = 1 + selector = 0 + usage = 0 + certificate_association_data = "d2abde240d7cd3ee6b4b28c54df034b97983a1d16e8a410e4561cb106618e971" + } + + tags = { + environment = "Production" + cost_center = "MSFT" + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) +} + +func (DnsTLSARecordResource) withTagsUpdate(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dns_zone" "test" { + name = "acctestzone%d.com" + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_dns_tlsa_record" "test" { + name = "myarecord%d" + dns_zone_id = azurerm_dns_zone.test.id + ttl = 300 + + record { + matching_type = 1 + selector = 1 + usage = 3 + certificate_association_data = "370C66FD4A0673CE1B62E76B819835DABB20702E4497CB10AFFE46E8135381E7" + } + + record { + matching_type = 1 + selector = 0 + usage = 0 + certificate_association_data = "d2abde240d7cd3ee6b4b28c54df034b97983a1d16e8a410e4561cb106618e971" + } + + tags = { + environment = "staging" + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) +} diff --git a/internal/services/dns/dns_txt_record_data_source.go b/internal/services/dns/dns_txt_record_data_source.go index 3716c7a5634d..a95a8f133908 100644 --- a/internal/services/dns/dns_txt_record_data_source.go +++ b/internal/services/dns/dns_txt_record_data_source.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/internal/services/dns/dns_txt_record_resource.go b/internal/services/dns/dns_txt_record_resource.go index fef0b06ed465..736df2499f81 100644 --- a/internal/services/dns/dns_txt_record_resource.go +++ b/internal/services/dns/dns_txt_record_resource.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/migration" diff --git a/internal/services/dns/dns_txt_record_resource_test.go b/internal/services/dns/dns_txt_record_resource_test.go index 405d1ef41264..138fa9e01192 100644 --- a/internal/services/dns/dns_txt_record_resource_test.go +++ b/internal/services/dns/dns_txt_record_resource_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/dns/dns_zone_data_source.go b/internal/services/dns/dns_zone_data_source.go index df07f46d09a6..b285780bbe22 100644 --- a/internal/services/dns/dns_zone_data_source.go +++ b/internal/services/dns/dns_zone_data_source.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/internal/services/dns/dns_zone_resource.go b/internal/services/dns/dns_zone_resource.go index e0a672a77e73..df24a9053f59 100644 --- a/internal/services/dns/dns_zone_resource.go +++ b/internal/services/dns/dns_zone_resource.go @@ -12,8 +12,8 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/migration" diff --git a/internal/services/dns/dns_zone_resource_test.go b/internal/services/dns/dns_zone_resource_test.go index 698717da38c3..f484f6b7823e 100644 --- a/internal/services/dns/dns_zone_resource_test.go +++ b/internal/services/dns/dns_zone_resource_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/dns/migration/a_record_v0_to_v1.go b/internal/services/dns/migration/a_record_v0_to_v1.go index 91e5a98e35dd..0ca26e534703 100644 --- a/internal/services/dns/migration/a_record_v0_to_v1.go +++ b/internal/services/dns/migration/a_record_v0_to_v1.go @@ -7,7 +7,7 @@ import ( "context" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/dns/migration/aaaa_record_v0_to_v1.go b/internal/services/dns/migration/aaaa_record_v0_to_v1.go index 258d7164d272..2a40149c20f5 100644 --- a/internal/services/dns/migration/aaaa_record_v0_to_v1.go +++ b/internal/services/dns/migration/aaaa_record_v0_to_v1.go @@ -7,7 +7,7 @@ import ( "context" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/set" diff --git a/internal/services/dns/migration/caa_record_v0_to_v1.go b/internal/services/dns/migration/caa_record_v0_to_v1.go index 4f452fcbd864..e243ef1e6e71 100644 --- a/internal/services/dns/migration/caa_record_v0_to_v1.go +++ b/internal/services/dns/migration/caa_record_v0_to_v1.go @@ -9,7 +9,7 @@ import ( "fmt" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/dns/migration/cname_record_v0_to_v1.go b/internal/services/dns/migration/cname_record_v0_to_v1.go index edb1d9b0f071..a9b34e47740e 100644 --- a/internal/services/dns/migration/cname_record_v0_to_v1.go +++ b/internal/services/dns/migration/cname_record_v0_to_v1.go @@ -7,7 +7,7 @@ import ( "context" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/dns/migration/dns_zone_V0_to_V1.go b/internal/services/dns/migration/dns_zone_V0_to_V1.go index 966cee2a7ef7..d217d704d617 100644 --- a/internal/services/dns/migration/dns_zone_V0_to_V1.go +++ b/internal/services/dns/migration/dns_zone_V0_to_V1.go @@ -8,7 +8,7 @@ import ( "fmt" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/dns/migration/dns_zone_v1_to_v2.go b/internal/services/dns/migration/dns_zone_v1_to_v2.go index d0244913f9f9..c2223d981b2f 100644 --- a/internal/services/dns/migration/dns_zone_v1_to_v2.go +++ b/internal/services/dns/migration/dns_zone_v1_to_v2.go @@ -7,7 +7,7 @@ import ( "context" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/dns/migration/mx_record_v0_to_v1.go b/internal/services/dns/migration/mx_record_v0_to_v1.go index fef5419d07a4..8eb7124da80c 100644 --- a/internal/services/dns/migration/mx_record_v0_to_v1.go +++ b/internal/services/dns/migration/mx_record_v0_to_v1.go @@ -9,7 +9,7 @@ import ( "fmt" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/dns/migration/ns_record_v0_to_v1.go b/internal/services/dns/migration/ns_record_v0_to_v1.go index 195cf1646f5d..52fb155aa338 100644 --- a/internal/services/dns/migration/ns_record_v0_to_v1.go +++ b/internal/services/dns/migration/ns_record_v0_to_v1.go @@ -7,7 +7,7 @@ import ( "context" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/dns/migration/ptr_record_v0_to_v1.go b/internal/services/dns/migration/ptr_record_v0_to_v1.go index a33c1fa4a2bb..fac2d437f661 100644 --- a/internal/services/dns/migration/ptr_record_v0_to_v1.go +++ b/internal/services/dns/migration/ptr_record_v0_to_v1.go @@ -7,7 +7,7 @@ import ( "context" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/dns/migration/srv_record_v0_to_v1.go b/internal/services/dns/migration/srv_record_v0_to_v1.go index 5544fd4f97fe..2b3560b6ed15 100644 --- a/internal/services/dns/migration/srv_record_v0_to_v1.go +++ b/internal/services/dns/migration/srv_record_v0_to_v1.go @@ -9,7 +9,7 @@ import ( "fmt" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/dns/migration/txt_record_v0_to_v1.go b/internal/services/dns/migration/txt_record_v0_to_v1.go index 51cd67ac9724..a82f6ec87be3 100644 --- a/internal/services/dns/migration/txt_record_v0_to_v1.go +++ b/internal/services/dns/migration/txt_record_v0_to_v1.go @@ -7,7 +7,7 @@ import ( "context" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" diff --git a/internal/services/dns/registration.go b/internal/services/dns/registration.go index 7b06cc559f27..09a3f40930b0 100644 --- a/internal/services/dns/registration.go +++ b/internal/services/dns/registration.go @@ -10,7 +10,10 @@ import ( type Registration struct{} -var _ sdk.UntypedServiceRegistrationWithAGitHubLabel = Registration{} +var ( + _ sdk.TypedServiceRegistration = Registration{} + _ sdk.UntypedServiceRegistrationWithAGitHubLabel = Registration{} +) func (r Registration) AssociatedGitHubLabel() string { return "service/dns" @@ -60,3 +63,19 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { "azurerm_dns_zone": resourceDnsZone(), } } + +// DataSources returns a list of Data Sources supported by this Service +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{ + DnsDSRecordDataResource{}, + DnsTLSARecordDataResource{}, + } +} + +// Resources returns a list of Resources supported by this Service +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{ + DnsDSRecordResource{}, + DnsTLSARecordResource{}, + } +} diff --git a/internal/services/dns/validate/dns_record_type_id.go b/internal/services/dns/validate/dns_record_type_id.go new file mode 100644 index 000000000000..c387f4257a77 --- /dev/null +++ b/internal/services/dns/validate/dns_record_type_id.go @@ -0,0 +1,25 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package validate + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" +) + +func ValidateRecordTypeID(recordType recordsets.RecordType) func(interface{}, string) ([]string, []error) { + return func(input interface{}, key string) (warnings []string, errors []error) { + parsed, err := recordsets.ParseRecordTypeID(input.(string)) + if err != nil { + errors = append(errors, err) + return + } + if parsed.RecordType != recordType { + errors = append(errors, fmt.Errorf("this resource only supports '%q' records", recordType)) + return + } + return + } +} diff --git a/internal/services/dns/validate/dns_record_type_id_test.go b/internal/services/dns/validate/dns_record_type_id_test.go new file mode 100644 index 000000000000..2219863a1e61 --- /dev/null +++ b/internal/services/dns/validate/dns_record_type_id_test.go @@ -0,0 +1,44 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package validate + +import ( + "testing" + + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" +) + +func TestValidateRecordTypeID(t *testing.T) { + cases := []struct { + RecordType recordsets.RecordType + Value string + Errors int + }{ + { + RecordType: recordsets.RecordTypeA, + Value: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/dnsZones/domain.com/TXT/testrecord", + Errors: 1, + }, + { + RecordType: recordsets.RecordTypeTXT, + Value: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/dnsZones/domain.com/TXT/testrecord", + Errors: 0, + }, + { + RecordType: recordsets.RecordTypeTXT, + Value: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Errors: 1, + }, + } + + for _, tc := range cases { + t.Run(tc.Value, func(t *testing.T) { + _, errors := ValidateRecordTypeID(tc.RecordType)(tc.Value, "id") + + if len(errors) != tc.Errors { + t.Fatalf("Expected ValidateRecordTypeID to return %d error(s) not %d", tc.Errors, len(errors)) + } + }) + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/LICENSE b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/LICENSE deleted file mode 100644 index 1786756f57c8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/LICENSE +++ /dev/null @@ -1,375 +0,0 @@ -Copyright (c) 2022 HashiCorp, Inc. - -Mozilla Public License Version 2.0 -================================== - -1. Definitions --------------- - -1.1. "Contributor" - means each individual or legal entity that creates, contributes to - the creation of, or owns Covered Software. - -1.2. "Contributor Version" - means the combination of the Contributions of others (if any) used - by a Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - means Source Code Form to which the initial Contributor has attached - the notice in Exhibit A, the Executable Form of such Source Code - Form, and Modifications of such Source Code Form, in each case - including portions thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - (a) that the initial Contributor has attached the notice described - in Exhibit B to the Covered Software; or - - (b) that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the - terms of a Secondary License. - -1.6. "Executable Form" - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - means a work that combines Covered Software with other material, in - a separate file or files, that is not Covered Software. - -1.8. "License" - means this document. - -1.9. "Licensable" - means having the right to grant, to the maximum extent possible, - whether at the time of the initial grant or subsequently, any and - all of the rights conveyed by this License. - -1.10. "Modifications" - means any of the following: - - (a) any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered - Software; or - - (b) any new file in Source Code Form that contains any Covered - Software. - -1.11. "Patent Claims" of a Contributor - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the - License, by the making, using, selling, offering for sale, having - made, import, or transfer of either its Contributions or its - Contributor Version. - -1.12. "Secondary License" - means either the GNU General Public License, Version 2.0, the GNU - Lesser General Public License, Version 2.1, the GNU Affero General - Public License, Version 3.0, or any later versions of those - licenses. - -1.13. "Source Code Form" - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants and Conditions --------------------------------- - -2.1. Grants - -Each Contributor hereby grants You a world-wide, royalty-free, -non-exclusive license: - -(a) under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - -(b) under Patent Claims of such Contributor to make, use, sell, offer - for sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - -The licenses granted in Section 2.1 with respect to any Contribution -become effective for each Contribution on the date the Contributor first -distributes such Contribution. - -2.3. Limitations on Grant Scope - -The licenses granted in this Section 2 are the only rights granted under -this License. No additional rights or licenses will be implied from the -distribution or licensing of Covered Software under this License. -Notwithstanding Section 2.1(b) above, no patent license is granted by a -Contributor: - -(a) for any code that a Contributor has removed from Covered Software; - or - -(b) for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - -(c) under Patent Claims infringed by Covered Software in the absence of - its Contributions. - -This License does not grant any rights in the trademarks, service marks, -or logos of any Contributor (except as may be necessary to comply with -the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - -No Contributor makes additional grants as a result of Your choice to -distribute the Covered Software under a subsequent version of this -License (see Section 10.2) or under the terms of a Secondary License (if -permitted under the terms of Section 3.3). - -2.5. Representation - -Each Contributor represents that the Contributor believes its -Contributions are its original creation(s) or it has sufficient rights -to grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - -This License is not intended to limit any rights You have under -applicable copyright doctrines of fair use, fair dealing, or other -equivalents. - -2.7. Conditions - -Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted -in Section 2.1. - -3. Responsibilities -------------------- - -3.1. Distribution of Source Form - -All distribution of Covered Software in Source Code Form, including any -Modifications that You create or to which You contribute, must be under -the terms of this License. You must inform recipients that the Source -Code Form of the Covered Software is governed by the terms of this -License, and how they can obtain a copy of this License. You may not -attempt to alter or restrict the recipients' rights in the Source Code -Form. - -3.2. Distribution of Executable Form - -If You distribute Covered Software in Executable Form then: - -(a) such Covered Software must also be made available in Source Code - Form, as described in Section 3.1, and You must inform recipients of - the Executable Form how they can obtain a copy of such Source Code - Form by reasonable means in a timely manner, at a charge no more - than the cost of distribution to the recipient; and - -(b) You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter - the recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - -You may create and distribute a Larger Work under terms of Your choice, -provided that You also comply with the requirements of this License for -the Covered Software. If the Larger Work is a combination of Covered -Software with a work governed by one or more Secondary Licenses, and the -Covered Software is not Incompatible With Secondary Licenses, this -License permits You to additionally distribute such Covered Software -under the terms of such Secondary License(s), so that the recipient of -the Larger Work may, at their option, further distribute the Covered -Software under the terms of either this License or such Secondary -License(s). - -3.4. Notices - -You may not remove or alter the substance of any license notices -(including copyright notices, patent notices, disclaimers of warranty, -or limitations of liability) contained within the Source Code Form of -the Covered Software, except that You may alter any license notices to -the extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - -You may choose to offer, and to charge a fee for, warranty, support, -indemnity or liability obligations to one or more recipients of Covered -Software. However, You may do so only on Your own behalf, and not on -behalf of any Contributor. You must make it absolutely clear that any -such warranty, support, indemnity, or liability obligation is offered by -You alone, and You hereby agree to indemnify every Contributor for any -liability incurred by such Contributor as a result of warranty, support, -indemnity or liability terms You offer. You may include additional -disclaimers of warranty and limitations of liability specific to any -jurisdiction. - -4. Inability to Comply Due to Statute or Regulation ---------------------------------------------------- - -If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Software due to -statute, judicial order, or regulation then You must: (a) comply with -the terms of this License to the maximum extent possible; and (b) -describe the limitations and the code they affect. Such description must -be placed in a text file included with all distributions of the Covered -Software under this License. Except to the extent prohibited by statute -or regulation, such description must be sufficiently detailed for a -recipient of ordinary skill to be able to understand it. - -5. Termination --------------- - -5.1. The rights granted under this License will terminate automatically -if You fail to comply with any of its terms. However, if You become -compliant, then the rights granted under this License from a particular -Contributor are reinstated (a) provisionally, unless and until such -Contributor explicitly and finally terminates Your grants, and (b) on an -ongoing basis, if such Contributor fails to notify You of the -non-compliance by some reasonable means prior to 60 days after You have -come back into compliance. Moreover, Your grants from a particular -Contributor are reinstated on an ongoing basis if such Contributor -notifies You of the non-compliance by some reasonable means, this is the -first time You have received notice of non-compliance with this License -from such Contributor, and You become compliant prior to 30 days after -Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent -infringement claim (excluding declaratory judgment actions, -counter-claims, and cross-claims) alleging that a Contributor Version -directly or indirectly infringes any patent, then the rights granted to -You by any and all Contributors for the Covered Software under Section -2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all -end user license agreements (excluding distributors and resellers) which -have been validly granted by You or Your distributors under this License -prior to termination shall survive termination. - -************************************************************************ -* * -* 6. Disclaimer of Warranty * -* ------------------------- * -* * -* Covered Software is provided under this License on an "as is" * -* basis, without warranty of any kind, either expressed, implied, or * -* statutory, including, without limitation, warranties that the * -* Covered Software is free of defects, merchantable, fit for a * -* particular purpose or non-infringing. The entire risk as to the * -* quality and performance of the Covered Software is with You. * -* Should any Covered Software prove defective in any respect, You * -* (not any Contributor) assume the cost of any necessary servicing, * -* repair, or correction. This disclaimer of warranty constitutes an * -* essential part of this License. No use of any Covered Software is * -* authorized under this License except under this disclaimer. * -* * -************************************************************************ - -************************************************************************ -* * -* 7. Limitation of Liability * -* -------------------------- * -* * -* Under no circumstances and under no legal theory, whether tort * -* (including negligence), contract, or otherwise, shall any * -* Contributor, or anyone who distributes Covered Software as * -* permitted above, be liable to You for any direct, indirect, * -* special, incidental, or consequential damages of any character * -* including, without limitation, damages for lost profits, loss of * -* goodwill, work stoppage, computer failure or malfunction, or any * -* and all other commercial damages or losses, even if such party * -* shall have been informed of the possibility of such damages. This * -* limitation of liability shall not apply to liability for death or * -* personal injury resulting from such party's negligence to the * -* extent applicable law prohibits such limitation. Some * -* jurisdictions do not allow the exclusion or limitation of * -* incidental or consequential damages, so this exclusion and * -* limitation may not apply to You. * -* * -************************************************************************ - -8. Litigation -------------- - -Any litigation relating to this License may be brought only in the -courts of a jurisdiction where the defendant maintains its principal -place of business and such litigation shall be governed by laws of that -jurisdiction, without reference to its conflict-of-law provisions. -Nothing in this Section shall prevent a party's ability to bring -cross-claims or counter-claims. - -9. Miscellaneous ----------------- - -This License represents the complete agreement concerning the subject -matter hereof. If any provision of this License is held to be -unenforceable, such provision shall be reformed only to the extent -necessary to make it enforceable. Any law or regulation which provides -that the language of a contract shall be construed against the drafter -shall not be used to construe this License against a Contributor. - -10. Versions of the License ---------------------------- - -10.1. New Versions - -Mozilla Foundation is the license steward. Except as provided in Section -10.3, no one other than the license steward has the right to modify or -publish new versions of this License. Each version will be given a -distinguishing version number. - -10.2. Effect of New Versions - -You may distribute the Covered Software under the terms of the version -of the License under which You originally received the Covered Software, -or under the terms of any subsequent version published by the license -steward. - -10.3. Modified Versions - -If you create software not governed by this License, and you want to -create a new license for such software, you may create and use a -modified version of this License if you rename the license and remove -any references to the name of the license steward (except to note that -such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary -Licenses - -If You choose to distribute Source Code Form that is Incompatible With -Secondary Licenses under the terms of this version of the License, the -notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice -------------------------------------------- - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular -file, then You may include the notice in a location (such as a LICENSE -file in a relevant directory) where a recipient would be likely to look -for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice ---------------------------------------------------------- - - This Source Code Form is "Incompatible With Secondary Licenses", as - defined by the Mozilla Public License, v. 2.0. diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_recordsetproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_recordsetproperties.go deleted file mode 100644 index a02004816a24..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_recordsetproperties.go +++ /dev/null @@ -1,22 +0,0 @@ -package recordsets - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RecordSetProperties struct { - AAAARecords *[]AaaaRecord `json:"AAAARecords,omitempty"` - ARecords *[]ARecord `json:"ARecords,omitempty"` - CNAMERecord *CnameRecord `json:"CNAMERecord,omitempty"` - CaaRecords *[]CaaRecord `json:"caaRecords,omitempty"` - Fqdn *string `json:"fqdn,omitempty"` - MXRecords *[]MxRecord `json:"MXRecords,omitempty"` - Metadata *map[string]string `json:"metadata,omitempty"` - NSRecords *[]NsRecord `json:"NSRecords,omitempty"` - PTRRecords *[]PtrRecord `json:"PTRRecords,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - SOARecord *SoaRecord `json:"SOARecord,omitempty"` - SRVRecords *[]SrvRecord `json:"SRVRecords,omitempty"` - TTL *int64 `json:"TTL,omitempty"` - TXTRecords *[]TxtRecord `json:"TXTRecords,omitempty"` - TargetResource *SubResource `json:"targetResource,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/client.go similarity index 53% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/client.go index a873d93163a2..e555d31d3542 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/client.go @@ -1,4 +1,4 @@ -package v2018_05_01 +package v2023_07_01_preview // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -6,17 +6,19 @@ package v2018_05_01 import ( "fmt" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" - "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { - Dns *dns.DnsClient - RecordSets *recordsets.RecordSetsClient - Zones *zones.ZonesClient + Dns *dns.DnsClient + DnssecConfigs *dnssecconfigs.DnssecConfigsClient + RecordSets *recordsets.RecordSetsClient + Zones *zones.ZonesClient } func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { @@ -26,6 +28,12 @@ func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanag } configureFunc(dnsClient.Client) + dnssecConfigsClient, err := dnssecconfigs.NewDnssecConfigsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building DnssecConfigs client: %+v", err) + } + configureFunc(dnssecConfigsClient.Client) + recordSetsClient, err := recordsets.NewRecordSetsClientWithBaseURI(sdkApi) if err != nil { return nil, fmt.Errorf("building RecordSets client: %+v", err) @@ -39,8 +47,9 @@ func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanag configureFunc(zonesClient.Client) return &Client{ - Dns: dnsClient, - RecordSets: recordSetsClient, - Zones: zonesClient, + Dns: dnsClient, + DnssecConfigs: dnssecConfigsClient, + RecordSets: recordSetsClient, + Zones: zonesClient, }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/README.md similarity index 85% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/README.md rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/README.md index 81bad9d549ab..31130dd6ce12 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/README.md @@ -1,7 +1,7 @@ -## `github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns` Documentation +## `github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns` Documentation -The `dns` SDK allows for interaction with Azure Resource Manager `dns` (API Version `2018-05-01`). +The `dns` SDK allows for interaction with Azure Resource Manager `dns` (API Version `2023-07-01-preview`). This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). @@ -9,7 +9,7 @@ This readme covers example usages, but further information on [using this SDK ca ```go import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -import "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns" +import "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns" ``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/method_resourcereferencegetbytargetresources.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/method_resourcereferencegetbytargetresources.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/method_resourcereferencegetbytargetresources.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/method_resourcereferencegetbytargetresources.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/model_dnsresourcereference.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereference.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/model_dnsresourcereference.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereferencerequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/model_dnsresourcereferencerequest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereferencerequest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/model_dnsresourcereferencerequest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereferencerequestproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/model_dnsresourcereferencerequestproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereferencerequestproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/model_dnsresourcereferencerequestproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereferenceresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/model_dnsresourcereferenceresult.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereferenceresult.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/model_dnsresourcereferenceresult.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereferenceresultproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/model_dnsresourcereferenceresultproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereferenceresultproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/model_dnsresourcereferenceresultproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_subresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/model_subresource.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_subresource.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/model_subresource.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/version.go similarity index 65% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/version.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/version.go index b3a1c232b5a2..5cbbbf4c0976 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns/version.go @@ -3,8 +3,8 @@ package dns // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2018-05-01" +const defaultApiVersion = "2023-07-01-preview" func userAgent() string { - return "hashicorp/go-azure-sdk/dns/2018-05-01" + return "hashicorp/go-azure-sdk/dns/2023-07-01-preview" } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/README.md new file mode 100644 index 000000000000..09f856589bc2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/README.md @@ -0,0 +1,77 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs` Documentation + +The `dnssecconfigs` SDK allows for interaction with Azure Resource Manager `dns` (API Version `2023-07-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs" +``` + + +### Client Initialization + +```go +client := dnssecconfigs.NewDnssecConfigsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DnssecConfigsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := dnssecconfigs.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dnsZoneName") + +if err := client.CreateOrUpdateThenPoll(ctx, id, dnssecconfigs.DefaultCreateOrUpdateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `DnssecConfigsClient.Delete` + +```go +ctx := context.TODO() +id := dnssecconfigs.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dnsZoneName") + +if err := client.DeleteThenPoll(ctx, id, dnssecconfigs.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `DnssecConfigsClient.Get` + +```go +ctx := context.TODO() +id := dnssecconfigs.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dnsZoneName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DnssecConfigsClient.ListByDnsZone` + +```go +ctx := context.TODO() +id := dnssecconfigs.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dnsZoneName") + +// alternatively `client.ListByDnsZone(ctx, id)` can be used to do batched pagination +items, err := client.ListByDnsZoneComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/client.go new file mode 100644 index 000000000000..d121bc362dff --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/client.go @@ -0,0 +1,26 @@ +package dnssecconfigs + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnssecConfigsClient struct { + Client *resourcemanager.Client +} + +func NewDnssecConfigsClientWithBaseURI(sdkApi sdkEnv.Api) (*DnssecConfigsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "dnssecconfigs", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DnssecConfigsClient: %+v", err) + } + + return &DnssecConfigsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/id_dnszone.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/id_dnszone.go new file mode 100644 index 000000000000..9c8fdd49b7a9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/id_dnszone.go @@ -0,0 +1,130 @@ +package dnssecconfigs + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&DnsZoneId{}) +} + +var _ resourceids.ResourceId = &DnsZoneId{} + +// DnsZoneId is a struct representing the Resource ID for a Dns Zone +type DnsZoneId struct { + SubscriptionId string + ResourceGroupName string + DnsZoneName string +} + +// NewDnsZoneID returns a new DnsZoneId struct +func NewDnsZoneID(subscriptionId string, resourceGroupName string, dnsZoneName string) DnsZoneId { + return DnsZoneId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DnsZoneName: dnsZoneName, + } +} + +// ParseDnsZoneID parses 'input' into a DnsZoneId +func ParseDnsZoneID(input string) (*DnsZoneId, error) { + parser := resourceids.NewParserFromResourceIdType(&DnsZoneId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DnsZoneId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseDnsZoneIDInsensitively parses 'input' case-insensitively into a DnsZoneId +// note: this method should only be used for API response data and not user input +func ParseDnsZoneIDInsensitively(input string) (*DnsZoneId, error) { + parser := resourceids.NewParserFromResourceIdType(&DnsZoneId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DnsZoneId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DnsZoneId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.DnsZoneName, ok = input.Parsed["dnsZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsZoneName", input) + } + + return nil +} + +// ValidateDnsZoneID checks that 'input' can be parsed as a Dns Zone ID +func ValidateDnsZoneID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDnsZoneID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Dns Zone ID +func (id DnsZoneId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnsZones/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DnsZoneName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Dns Zone ID +func (id DnsZoneId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), + resourceids.StaticSegment("staticDnsZones", "dnsZones", "dnsZones"), + resourceids.UserSpecifiedSegment("dnsZoneName", "dnsZoneName"), + } +} + +// String returns a human-readable description of this Dns Zone ID +func (id DnsZoneId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Dns Zone Name: %q", id.DnsZoneName), + } + return fmt.Sprintf("Dns Zone (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/method_createorupdate.go new file mode 100644 index 000000000000..a103e3450686 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/method_createorupdate.go @@ -0,0 +1,104 @@ +package dnssecconfigs + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *DnssecConfig +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + if o.IfNoneMatch != nil { + out.Append("If-None-Match", fmt.Sprintf("%v", *o.IfNoneMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c DnssecConfigsClient) CreateOrUpdate(ctx context.Context, id DnsZoneId, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + OptionsObject: options, + Path: fmt.Sprintf("%s/dnssecConfigs/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c DnssecConfigsClient) CreateOrUpdateThenPoll(ctx context.Context, id DnsZoneId, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, options) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/method_delete.go new file mode 100644 index 000000000000..4e9bb11ecafa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/method_delete.go @@ -0,0 +1,100 @@ +package dnssecconfigs + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c DnssecConfigsClient) Delete(ctx context.Context, id DnsZoneId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + OptionsObject: options, + Path: fmt.Sprintf("%s/dnssecConfigs/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c DnssecConfigsClient) DeleteThenPoll(ctx context.Context, id DnsZoneId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/method_get.go new file mode 100644 index 000000000000..3fc5afed138c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/method_get.go @@ -0,0 +1,54 @@ +package dnssecconfigs + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DnssecConfig +} + +// Get ... +func (c DnssecConfigsClient) Get(ctx context.Context, id DnsZoneId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/dnssecConfigs/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model DnssecConfig + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/method_listbydnszone.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/method_listbydnszone.go new file mode 100644 index 000000000000..2b74c20e9fec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/method_listbydnszone.go @@ -0,0 +1,105 @@ +package dnssecconfigs + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByDnsZoneOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DnssecConfig +} + +type ListByDnsZoneCompleteResult struct { + LatestHttpResponse *http.Response + Items []DnssecConfig +} + +type ListByDnsZoneCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByDnsZoneCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByDnsZone ... +func (c DnssecConfigsClient) ListByDnsZone(ctx context.Context, id DnsZoneId) (result ListByDnsZoneOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByDnsZoneCustomPager{}, + Path: fmt.Sprintf("%s/dnssecConfigs", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DnssecConfig `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByDnsZoneComplete retrieves all the results into a single object +func (c DnssecConfigsClient) ListByDnsZoneComplete(ctx context.Context, id DnsZoneId) (ListByDnsZoneCompleteResult, error) { + return c.ListByDnsZoneCompleteMatchingPredicate(ctx, id, DnssecConfigOperationPredicate{}) +} + +// ListByDnsZoneCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DnssecConfigsClient) ListByDnsZoneCompleteMatchingPredicate(ctx context.Context, id DnsZoneId, predicate DnssecConfigOperationPredicate) (result ListByDnsZoneCompleteResult, err error) { + items := make([]DnssecConfig, 0) + + resp, err := c.ListByDnsZone(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByDnsZoneCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/model_delegationsignerinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/model_delegationsignerinfo.go new file mode 100644 index 000000000000..8c3433564e2e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/model_delegationsignerinfo.go @@ -0,0 +1,10 @@ +package dnssecconfigs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DelegationSignerInfo struct { + DigestAlgorithmType *int64 `json:"digestAlgorithmType,omitempty"` + DigestValue *string `json:"digestValue,omitempty"` + Record *string `json:"record,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/model_dnssecconfig.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/model_dnssecconfig.go new file mode 100644 index 000000000000..a7a9beeb3479 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/model_dnssecconfig.go @@ -0,0 +1,17 @@ +package dnssecconfigs + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnssecConfig struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DnssecProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/model_dnssecproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/model_dnssecproperties.go new file mode 100644 index 000000000000..e5c34d7036dc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/model_dnssecproperties.go @@ -0,0 +1,9 @@ +package dnssecconfigs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnssecProperties struct { + ProvisioningState *string `json:"provisioningState,omitempty"` + SigningKeys *[]SigningKey `json:"signingKeys,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/model_signingkey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/model_signingkey.go new file mode 100644 index 000000000000..c892d1a4932a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/model_signingkey.go @@ -0,0 +1,13 @@ +package dnssecconfigs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SigningKey struct { + DelegationSignerInfo *[]DelegationSignerInfo `json:"delegationSignerInfo,omitempty"` + Flags *int64 `json:"flags,omitempty"` + KeyTag *int64 `json:"keyTag,omitempty"` + Protocol *int64 `json:"protocol,omitempty"` + PublicKey *string `json:"publicKey,omitempty"` + SecurityAlgorithmType *int64 `json:"securityAlgorithmType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/predicates.go new file mode 100644 index 000000000000..2fc9a4a3240d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/predicates.go @@ -0,0 +1,32 @@ +package dnssecconfigs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnssecConfigOperationPredicate struct { + Etag *string + Id *string + Name *string + Type *string +} + +func (p DnssecConfigOperationPredicate) Matches(input DnssecConfig) bool { + + if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/version.go new file mode 100644 index 000000000000..650d6c7f55fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs/version.go @@ -0,0 +1,10 @@ +package dnssecconfigs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2023-07-01-preview" + +func userAgent() string { + return "hashicorp/go-azure-sdk/dnssecconfigs/2023-07-01-preview" +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/README.md similarity index 95% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/README.md rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/README.md index b64e26c566b1..a26d46c69579 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/README.md @@ -1,14 +1,14 @@ -## `github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets` Documentation +## `github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets` Documentation -The `recordsets` SDK allows for interaction with Azure Resource Manager `dns` (API Version `2018-05-01`). +The `recordsets` SDK allows for interaction with Azure Resource Manager `dns` (API Version `2023-07-01-preview`). This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). ### Import Path ```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" +import "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets" ``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/constants.go similarity index 87% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/constants.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/constants.go index cb6883e32a0c..dee6fc19e0e9 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/constants.go @@ -16,11 +16,14 @@ const ( RecordTypeAAAA RecordType = "AAAA" RecordTypeCAA RecordType = "CAA" RecordTypeCNAME RecordType = "CNAME" + RecordTypeDS RecordType = "DS" RecordTypeMX RecordType = "MX" + RecordTypeNAPTR RecordType = "NAPTR" RecordTypeNS RecordType = "NS" RecordTypePTR RecordType = "PTR" RecordTypeSOA RecordType = "SOA" RecordTypeSRV RecordType = "SRV" + RecordTypeTLSA RecordType = "TLSA" RecordTypeTXT RecordType = "TXT" ) @@ -30,11 +33,14 @@ func PossibleValuesForRecordType() []string { string(RecordTypeAAAA), string(RecordTypeCAA), string(RecordTypeCNAME), + string(RecordTypeDS), string(RecordTypeMX), + string(RecordTypeNAPTR), string(RecordTypeNS), string(RecordTypePTR), string(RecordTypeSOA), string(RecordTypeSRV), + string(RecordTypeTLSA), string(RecordTypeTXT), } } @@ -58,11 +64,14 @@ func parseRecordType(input string) (*RecordType, error) { "aaaa": RecordTypeAAAA, "caa": RecordTypeCAA, "cname": RecordTypeCNAME, + "ds": RecordTypeDS, "mx": RecordTypeMX, + "naptr": RecordTypeNAPTR, "ns": RecordTypeNS, "ptr": RecordTypePTR, "soa": RecordTypeSOA, "srv": RecordTypeSRV, + "tlsa": RecordTypeTLSA, "txt": RecordTypeTXT, } if v, ok := vals[strings.ToLower(input)]; ok { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_dnszone.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/id_dnszone.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_dnszone.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/id_dnszone.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_recordtype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/id_recordtype.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_recordtype.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/id_recordtype.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_zone.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/id_zone.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_zone.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/id_zone.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/method_createorupdate.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_createorupdate.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/method_createorupdate.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/method_delete.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_delete.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/method_delete.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/method_get.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_get.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/method_get.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_listallbydnszone.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/method_listallbydnszone.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_listallbydnszone.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/method_listallbydnszone.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_listbydnszone.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/method_listbydnszone.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_listbydnszone.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/method_listbydnszone.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_listbytype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/method_listbytype.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_listbytype.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/method_listbytype.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/method_update.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_update.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/method_update.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_aaaarecord.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_aaaarecord.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_aaaarecord.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_aaaarecord.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_arecord.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_arecord.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_arecord.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_arecord.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_caarecord.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_caarecord.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_caarecord.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_caarecord.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_cnamerecord.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_cnamerecord.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_cnamerecord.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_cnamerecord.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_digest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_digest.go new file mode 100644 index 000000000000..7974469b7d84 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_digest.go @@ -0,0 +1,9 @@ +package recordsets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Digest struct { + AlgorithmType *int64 `json:"algorithmType,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_dsrecord.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_dsrecord.go new file mode 100644 index 000000000000..79527c1e34d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_dsrecord.go @@ -0,0 +1,10 @@ +package recordsets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DsRecord struct { + Algorithm *int64 `json:"algorithm,omitempty"` + Digest *Digest `json:"digest,omitempty"` + KeyTag *int64 `json:"keyTag,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_mxrecord.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_mxrecord.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_mxrecord.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_mxrecord.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_naptrrecord.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_naptrrecord.go new file mode 100644 index 000000000000..2826177363c5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_naptrrecord.go @@ -0,0 +1,13 @@ +package recordsets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NaptrRecord struct { + Flags *string `json:"flags,omitempty"` + Order *int64 `json:"order,omitempty"` + Preference *int64 `json:"preference,omitempty"` + Regexp *string `json:"regexp,omitempty"` + Replacement *string `json:"replacement,omitempty"` + Services *string `json:"services,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_nsrecord.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_nsrecord.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_nsrecord.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_nsrecord.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_ptrrecord.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_ptrrecord.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_ptrrecord.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_ptrrecord.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_recordset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_recordset.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_recordset.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_recordset.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_recordsetproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_recordsetproperties.go new file mode 100644 index 000000000000..ded3f16c5150 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_recordsetproperties.go @@ -0,0 +1,26 @@ +package recordsets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RecordSetProperties struct { + AAAARecords *[]AaaaRecord `json:"AAAARecords,omitempty"` + ARecords *[]ARecord `json:"ARecords,omitempty"` + CNAMERecord *CnameRecord `json:"CNAMERecord,omitempty"` + CaaRecords *[]CaaRecord `json:"caaRecords,omitempty"` + DSRecords *[]DsRecord `json:"DSRecords,omitempty"` + Fqdn *string `json:"fqdn,omitempty"` + MXRecords *[]MxRecord `json:"MXRecords,omitempty"` + Metadata *map[string]string `json:"metadata,omitempty"` + NAPTRRecords *[]NaptrRecord `json:"NAPTRRecords,omitempty"` + NSRecords *[]NsRecord `json:"NSRecords,omitempty"` + PTRRecords *[]PtrRecord `json:"PTRRecords,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + SOARecord *SoaRecord `json:"SOARecord,omitempty"` + SRVRecords *[]SrvRecord `json:"SRVRecords,omitempty"` + TLSARecords *[]TlsaRecord `json:"TLSARecords,omitempty"` + TTL *int64 `json:"TTL,omitempty"` + TXTRecords *[]TxtRecord `json:"TXTRecords,omitempty"` + TargetResource *SubResource `json:"targetResource,omitempty"` + TrafficManagementProfile *SubResource `json:"trafficManagementProfile,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_soarecord.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_soarecord.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_soarecord.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_soarecord.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_srvrecord.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_srvrecord.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_srvrecord.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_srvrecord.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_subresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_subresource.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_subresource.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_subresource.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_tlsarecord.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_tlsarecord.go new file mode 100644 index 000000000000..e66c65d2b8d5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_tlsarecord.go @@ -0,0 +1,11 @@ +package recordsets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TlsaRecord struct { + CertAssociationData *string `json:"certAssociationData,omitempty"` + MatchingType *int64 `json:"matchingType,omitempty"` + Selector *int64 `json:"selector,omitempty"` + Usage *int64 `json:"usage,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_txtrecord.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_txtrecord.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_txtrecord.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/model_txtrecord.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/predicates.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/predicates.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/predicates.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/version.go similarity index 65% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/version.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/version.go index 9fd6a2d70378..ae5333995d60 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets/version.go @@ -3,8 +3,8 @@ package recordsets // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2018-05-01" +const defaultApiVersion = "2023-07-01-preview" func userAgent() string { - return "hashicorp/go-azure-sdk/recordsets/2018-05-01" + return "hashicorp/go-azure-sdk/recordsets/2023-07-01-preview" } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/README.md new file mode 100644 index 000000000000..323c7e52af2c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/README.md @@ -0,0 +1,125 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones` Documentation + +The `zones` SDK allows for interaction with Azure Resource Manager `dns` (API Version `2023-07-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones" +``` + + +### Client Initialization + +```go +client := zones.NewZonesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ZonesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := zones.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dnsZoneName") + +payload := zones.Zone{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, zones.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ZonesClient.Delete` + +```go +ctx := context.TODO() +id := zones.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dnsZoneName") + +if err := client.DeleteThenPoll(ctx, id, zones.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `ZonesClient.Get` + +```go +ctx := context.TODO() +id := zones.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dnsZoneName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ZonesClient.List` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id, zones.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, zones.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ZonesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id, zones.DefaultListByResourceGroupOperationOptions())` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id, zones.DefaultListByResourceGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ZonesClient.Update` + +```go +ctx := context.TODO() +id := zones.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dnsZoneName") + +payload := zones.ZoneUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload, zones.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/client.go new file mode 100644 index 000000000000..6ebb05929734 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/client.go @@ -0,0 +1,26 @@ +package zones + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ZonesClient struct { + Client *resourcemanager.Client +} + +func NewZonesClientWithBaseURI(sdkApi sdkEnv.Api) (*ZonesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "zones", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ZonesClient: %+v", err) + } + + return &ZonesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/constants.go new file mode 100644 index 000000000000..85ad0a42db2a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/constants.go @@ -0,0 +1,51 @@ +package zones + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ZoneType string + +const ( + ZoneTypePrivate ZoneType = "Private" + ZoneTypePublic ZoneType = "Public" +) + +func PossibleValuesForZoneType() []string { + return []string{ + string(ZoneTypePrivate), + string(ZoneTypePublic), + } +} + +func (s *ZoneType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseZoneType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseZoneType(input string) (*ZoneType, error) { + vals := map[string]ZoneType{ + "private": ZoneTypePrivate, + "public": ZoneTypePublic, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ZoneType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/id_dnszone.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/id_dnszone.go new file mode 100644 index 000000000000..ac97aa86340d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/id_dnszone.go @@ -0,0 +1,130 @@ +package zones + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&DnsZoneId{}) +} + +var _ resourceids.ResourceId = &DnsZoneId{} + +// DnsZoneId is a struct representing the Resource ID for a Dns Zone +type DnsZoneId struct { + SubscriptionId string + ResourceGroupName string + DnsZoneName string +} + +// NewDnsZoneID returns a new DnsZoneId struct +func NewDnsZoneID(subscriptionId string, resourceGroupName string, dnsZoneName string) DnsZoneId { + return DnsZoneId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DnsZoneName: dnsZoneName, + } +} + +// ParseDnsZoneID parses 'input' into a DnsZoneId +func ParseDnsZoneID(input string) (*DnsZoneId, error) { + parser := resourceids.NewParserFromResourceIdType(&DnsZoneId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DnsZoneId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseDnsZoneIDInsensitively parses 'input' case-insensitively into a DnsZoneId +// note: this method should only be used for API response data and not user input +func ParseDnsZoneIDInsensitively(input string) (*DnsZoneId, error) { + parser := resourceids.NewParserFromResourceIdType(&DnsZoneId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DnsZoneId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DnsZoneId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.DnsZoneName, ok = input.Parsed["dnsZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsZoneName", input) + } + + return nil +} + +// ValidateDnsZoneID checks that 'input' can be parsed as a Dns Zone ID +func ValidateDnsZoneID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDnsZoneID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Dns Zone ID +func (id DnsZoneId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnsZones/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DnsZoneName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Dns Zone ID +func (id DnsZoneId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), + resourceids.StaticSegment("staticDnsZones", "dnsZones", "dnsZones"), + resourceids.UserSpecifiedSegment("dnsZoneName", "dnsZoneName"), + } +} + +// String returns a human-readable description of this Dns Zone ID +func (id DnsZoneId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Dns Zone Name: %q", id.DnsZoneName), + } + return fmt.Sprintf("Dns Zone (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/method_createorupdate.go new file mode 100644 index 000000000000..49fbfd68db90 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/method_createorupdate.go @@ -0,0 +1,92 @@ +package zones + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Zone +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + if o.IfNoneMatch != nil { + out.Append("If-None-Match", fmt.Sprintf("%v", *o.IfNoneMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ZonesClient) CreateOrUpdate(ctx context.Context, id DnsZoneId, input Zone, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + OptionsObject: options, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model Zone + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/method_delete.go new file mode 100644 index 000000000000..1a7de15564ca --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/method_delete.go @@ -0,0 +1,100 @@ +package zones + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ZonesClient) Delete(ctx context.Context, id DnsZoneId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + OptionsObject: options, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ZonesClient) DeleteThenPoll(ctx context.Context, id DnsZoneId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/method_get.go new file mode 100644 index 000000000000..985a441d1c5c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/method_get.go @@ -0,0 +1,53 @@ +package zones + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Zone +} + +// Get ... +func (c ZonesClient) Get(ctx context.Context, id DnsZoneId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model Zone + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/method_list.go new file mode 100644 index 000000000000..75d6571a50f6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/method_list.go @@ -0,0 +1,135 @@ +package zones + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Zone +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []Zone +} + +type ListOperationOptions struct { + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c ZonesClient) List(ctx context.Context, id commonids.SubscriptionId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Network/dnsZones", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Zone `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c ZonesClient) ListComplete(ctx context.Context, id commonids.SubscriptionId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, ZoneOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ZonesClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListOperationOptions, predicate ZoneOperationPredicate) (result ListCompleteResult, err error) { + items := make([]Zone, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/method_listbyresourcegroup.go new file mode 100644 index 000000000000..29df62cef251 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/method_listbyresourcegroup.go @@ -0,0 +1,135 @@ +package zones + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Zone +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []Zone +} + +type ListByResourceGroupOperationOptions struct { + Top *int64 +} + +func DefaultListByResourceGroupOperationOptions() ListByResourceGroupOperationOptions { + return ListByResourceGroupOperationOptions{} +} + +func (o ListByResourceGroupOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByResourceGroupOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListByResourceGroupOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c ZonesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Network/dnsZones", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Zone `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c ZonesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, options, ZoneOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ZonesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions, predicate ZoneOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]Zone, 0) + + resp, err := c.ListByResourceGroup(ctx, id, options) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/method_update.go new file mode 100644 index 000000000000..1fecfd55d9eb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/method_update.go @@ -0,0 +1,87 @@ +package zones + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Zone +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ZonesClient) Update(ctx context.Context, id DnsZoneId, input ZoneUpdate, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + OptionsObject: options, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model Zone + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/model_delegationsignerinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/model_delegationsignerinfo.go new file mode 100644 index 000000000000..6df27cf1e2be --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/model_delegationsignerinfo.go @@ -0,0 +1,10 @@ +package zones + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DelegationSignerInfo struct { + DigestAlgorithmType *int64 `json:"digestAlgorithmType,omitempty"` + DigestValue *string `json:"digestValue,omitempty"` + Record *string `json:"record,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/model_signingkey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/model_signingkey.go new file mode 100644 index 000000000000..13e0cb9cb6ae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/model_signingkey.go @@ -0,0 +1,13 @@ +package zones + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SigningKey struct { + DelegationSignerInfo *[]DelegationSignerInfo `json:"delegationSignerInfo,omitempty"` + Flags *int64 `json:"flags,omitempty"` + KeyTag *int64 `json:"keyTag,omitempty"` + Protocol *int64 `json:"protocol,omitempty"` + PublicKey *string `json:"publicKey,omitempty"` + SecurityAlgorithmType *int64 `json:"securityAlgorithmType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/model_subresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/model_subresource.go new file mode 100644 index 000000000000..325bcfb56e5b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/model_subresource.go @@ -0,0 +1,8 @@ +package zones + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/model_zone.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/model_zone.go new file mode 100644 index 000000000000..0637dc356e87 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/model_zone.go @@ -0,0 +1,19 @@ +package zones + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Zone struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ZoneProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/model_zoneproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/model_zoneproperties.go new file mode 100644 index 000000000000..ee95a0e14b5a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/model_zoneproperties.go @@ -0,0 +1,15 @@ +package zones + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ZoneProperties struct { + MaxNumberOfRecordSets *int64 `json:"maxNumberOfRecordSets,omitempty"` + MaxNumberOfRecordsPerRecordSet *int64 `json:"maxNumberOfRecordsPerRecordSet,omitempty"` + NameServers *[]string `json:"nameServers,omitempty"` + NumberOfRecordSets *int64 `json:"numberOfRecordSets,omitempty"` + RegistrationVirtualNetworks *[]SubResource `json:"registrationVirtualNetworks,omitempty"` + ResolutionVirtualNetworks *[]SubResource `json:"resolutionVirtualNetworks,omitempty"` + SigningKeys *[]SigningKey `json:"signingKeys,omitempty"` + ZoneType *ZoneType `json:"zoneType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/model_zoneupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/model_zoneupdate.go new file mode 100644 index 000000000000..6cfc17369a75 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/model_zoneupdate.go @@ -0,0 +1,8 @@ +package zones + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ZoneUpdate struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/predicates.go new file mode 100644 index 000000000000..cf1481741f8d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/predicates.go @@ -0,0 +1,37 @@ +package zones + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ZoneOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p ZoneOperationPredicate) Matches(input Zone) bool { + + if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/version.go new file mode 100644 index 000000000000..0304d64f1cf1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones/version.go @@ -0,0 +1,10 @@ +package zones + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2023-07-01-preview" + +func userAgent() string { + return "hashicorp/go-azure-sdk/zones/2023-07-01-preview" +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 434e92d526e9..6d58adbbb493 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -148,7 +148,7 @@ github.com/hashicorp/go-azure-helpers/resourcemanager/tags github.com/hashicorp/go-azure-helpers/resourcemanager/zones github.com/hashicorp/go-azure-helpers/sender github.com/hashicorp/go-azure-helpers/storage -# github.com/hashicorp/go-azure-sdk/resource-manager v0.20241206.1180327 +# github.com/hashicorp/go-azure-sdk/resource-manager v0.20241128.1112539 => ../go-azure-sdk/resource-manager ## explicit; go 1.22 github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview @@ -490,10 +490,12 @@ github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtual github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2023-01-31/digitaltwinsinstance github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2023-01-31/endpoints github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2023-01-31/timeseriesdatabaseconnections -github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01 -github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns -github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones +github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview +github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dns +github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/dnssecconfigs +github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/recordsets +github.com/hashicorp/go-azure-sdk/resource-manager/dns/2023-07-01-preview/zones github.com/hashicorp/go-azure-sdk/resource-manager/dnsresolver/2022-07-01/dnsforwardingrulesets github.com/hashicorp/go-azure-sdk/resource-manager/dnsresolver/2022-07-01/dnsresolvers github.com/hashicorp/go-azure-sdk/resource-manager/dnsresolver/2022-07-01/forwardingrules @@ -1673,3 +1675,4 @@ gopkg.in/yaml.v3 ## explicit; go 1.19 software.sslmate.com/src/go-pkcs12 software.sslmate.com/src/go-pkcs12/internal/rc2 +# github.com/hashicorp/go-azure-sdk/resource-manager => ../go-azure-sdk/resource-manager diff --git a/website/docs/d/dns_ds_record.html.markdown b/website/docs/d/dns_ds_record.html.markdown new file mode 100644 index 000000000000..e1de195e8c7b --- /dev/null +++ b/website/docs/d/dns_ds_record.html.markdown @@ -0,0 +1,62 @@ +--- +subcategory: "DNS" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_dns_ds_record" +description: |- + Gets information about an existing DNS DS Record. +--- + +# Data Source: azurerm_dns_ds_record + +Use this data source to access information about an existing DNS DS Record within Azure DNS. + +~> **Note:** [The Azure DNS API has a throttle limit of 500 read (GET) operations per 5 minutes](https://docs.microsoft.com/azure/azure-resource-manager/management/request-limits-and-throttling#network-throttling) - whilst the default read timeouts will work for most cases - in larger configurations you may need to set a larger [read timeout](https://www.terraform.io/language/resources/syntax#operation-timeouts) then the default 5min. Although, we'd generally recommend that you split the resources out into smaller Terraform configurations to avoid the problem entirely. + +## Example Usage + +```hcl +data "azurerm_dns_ds_record" "example" { + name = "test" + dns_zone_id = data.azurerm_dns_zone.example.id +} + +output "dns_ds_record_id" { + value = data.azurerm_dns_ds_record.example.id +} +``` + +## Argument Reference + +* `name` - The name of the DNS DS Record. + +* `dns_zone_id` - Specifies the DNS Zone ID where the resource exists. + +## Attributes Reference + +* `id` - The DNS DS Record ID. + +* `fqdn` - The FQDN of the DNS DS Record. + +* `ttl` - The Time To Live (TTL) of the DNS record in seconds. + +* `record` - A list of values that make up the DS record. Each `record` block supports fields documented below. + +* `tags` - A mapping of tags assigned to the resource. + +--- + +The `record` block supports: + +* `algorithm` - Identifies the algorithm used to produce a legitimate signature. + +* `key_tag` - Contains the tag value of the DNSKEY Resource Record that validates this signature. + +* `digest_type` - Identifies the algorithm used to construct the digest. + +* `digest_value` - A cryptographic hash value of the referenced DNSKEY Record. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the DNS DS Record. diff --git a/website/docs/d/dns_tlsa_record.html.markdown b/website/docs/d/dns_tlsa_record.html.markdown new file mode 100644 index 000000000000..9d5a6e36bb02 --- /dev/null +++ b/website/docs/d/dns_tlsa_record.html.markdown @@ -0,0 +1,62 @@ +--- +subcategory: "DNS" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_dns_tlsa_record" +description: |- + Gets information about an existing DNS TLSA Record. +--- + +# Data Source: azurerm_dns_tlsa_record + +Use this data source to access information about an existing DNS TLSA Record within Azure DNS. + +~> **Note:** [The Azure DNS API has a throttle limit of 500 read (GET) operations per 5 minutes](https://docs.microsoft.com/azure/azure-resource-manager/management/request-limits-and-throttling#network-throttling) - whilst the default read timeouts will work for most cases - in larger configurations you may need to set a larger [read timeout](https://www.terraform.io/language/resources/syntax#operation-timeouts) then the default 5min. Although, we'd generally recommend that you split the resources out into smaller Terraform configurations to avoid the problem entirely. + +## Example Usage + +```hcl +data "azurerm_dns_tlsa_record" "example" { + name = "test" + dns_zone_id = azurerm_dns_zone.example.id +} + +output "dns_tlsa_record_id" { + value = data.azurerm_dns_tlsa_record.example.id +} +``` + +## Argument Reference + +* `name` - The name of the DNS TLSA Record. + +* `dns_zone_id` - Specifies the DNS Zone ID where the resource exists. + +## Attributes Reference + +* `id` - The DNS TLSA Record ID. + +* `fqdn` - The FQDN of the DNS TLSA Record. + +* `ttl` - The Time To Live (TTL) of the DNS record in seconds. + +* `record` - A list of values that make up the TLSA record. Each `record` block supports fields documented below. + +* `tags` - A mapping of tags assigned to the resource. + +--- + +The `record` block supports: + +* `matching_type` - Matching Type of the TLSA record. + +* `selector` - Selector of the TLSA record. + +* `usage` - Usage of the TLSA record. + +* `certificate_association_data` - Certificate data to be matched. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the DNS SRV Record. diff --git a/website/docs/r/dns_ds_record.html.markdown b/website/docs/r/dns_ds_record.html.markdown new file mode 100644 index 000000000000..3ca8dc4fb7d2 --- /dev/null +++ b/website/docs/r/dns_ds_record.html.markdown @@ -0,0 +1,98 @@ +--- +subcategory: "DNS" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_dns_ds_record" +description: |- + Manages a DNS DS Record. +--- + +# azurerm_dns_ds_record + +Enables you to manage DNS DS Records within Azure DNS. + +~> **Note:** [The Azure DNS API has a throttle limit of 500 read (GET) operations per 5 minutes](https://docs.microsoft.com/azure/azure-resource-manager/management/request-limits-and-throttling#network-throttling) - whilst the default read timeouts will work for most cases - in larger configurations you may need to set a larger [read timeout](https://www.terraform.io/language/resources/syntax#operation-timeouts) then the default 5min. Although, we'd generally recommend that you split the resources out into smaller Terraform configurations to avoid the problem entirely. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_dns_zone" "example" { + name = "mydomain.com" + resource_group_name = azurerm_resource_group.example.name +} + +resource "azurerm_dns_ds_record" "example" { + name = "test" + dns_zone_id = azurerm_dns_zone.example.id + ttl = 300 + + record { + algorithm = 13 + key_tag = 28237 + digest_type = 2 + digest_value = "40F628643831D5EAF7D005D3237DE32F3F37AE6025C7891D202B0BAFA9924778" + } + + tags = { + Environment = "Production" + } +} +``` + +## Argument Reference + +The following arguments are supported: + +- `name` - (Required) The name of the DNS DS Record. Changing this forces a new resource to be created. + +- `dns_zone_id` - (Required) Specifies the DNS Zone ID where the resource exists. Changing this forces a new resource to be created. + +- `ttl` - (Required) The Time To Live (TTL) of the DNS record in seconds. + +- `record` - (Required) A list of values that make up the DS record. Each `record` block supports fields documented below. + +- `tags` - (Optional) A mapping of tags to assign to the resource. + +--- + +The `record` block supports: + +- `algorithm` - (Required) Identifies the algorithm used to produce a legitimate signature. + +- `key_tag` - (Required) Contains the tag value of the DNSKEY Resource Record that validates this signature. + +- `digest_type` - (Required) Identifies the algorithm used to construct the digest. + +- `digest_value` - (Required) A cryptographic hash value of the referenced DNSKEY Record. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +- `id` - The DNS DS Record ID. + +- `fqdn` - The FQDN of the DNS DS Record. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +- `create` - (Defaults to 30 minutes) Used when creating the DNS DS Record. + +- `update` - (Defaults to 30 minutes) Used when updating the DNS DS Record. + +- `read` - (Defaults to 5 minutes) Used when retrieving the DNS DS Record. + +- `delete` - (Defaults to 30 minutes) Used when deleting the DNS DS Record. + +## Import + +DS records can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_dns_ds_record.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/dnsZones/zone1/DS/myrecord1 +``` diff --git a/website/docs/r/dns_tlsa_record.html.markdown b/website/docs/r/dns_tlsa_record.html.markdown new file mode 100644 index 000000000000..47fdb9665ace --- /dev/null +++ b/website/docs/r/dns_tlsa_record.html.markdown @@ -0,0 +1,98 @@ +--- +subcategory: "DNS" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_dns_tlsa_record" +description: |- + Manages a DNS TLSA Record. +--- + +# azurerm_dns_tlsa_record + +Enables you to manage DNS TLSA Records within Azure DNS. + +~> **Note:** [The Azure DNS API has a throttle limit of 500 read (GET) operations per 5 minutes](https://docs.microsoft.com/azure/azure-resource-manager/management/request-limits-and-throttling#network-throttling) - whilst the default read timeouts will work for most cases - in larger configurations you may need to set a larger [read timeout](https://www.terraform.io/language/resources/syntax#operation-timeouts) then the default 5min. Although, we'd generally recommend that you split the resources out into smaller Terraform configurations to avoid the problem entirely. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_dns_zone" "example" { + name = "mydomain.com" + resource_group_name = azurerm_resource_group.example.name +} + +resource "azurerm_dns_tlsa_record" "example" { + name = "test" + dns_zone_id = azurerm_dns_zone.example.id + ttl = 300 + + record { + matching_type = 1 + selector = 1 + usage = 3 + certificate_association_data = "370c66fd4a0673ce1b62e76b819835dabb20702e4497cb10affe46e8135381e7" + } + + tags = { + Environment = "Production" + } +} +``` + +## Argument Reference + +The following arguments are supported: + +- `name` - (Required) The name of the DNS TLSA Record. Changing this forces a new resource to be created. + +- `dns_zone_id` - (Required) Specifies the DNS Zone ID where the resource exists. Changing this forces a new resource to be created. + +- `ttl` - (Required) The Time To Live (TTL) of the DNS record in seconds. + +- `record` - (Required) A list of values that make up the TLSA record. Each `record` block supports fields documented below. + +- `tags` - (Optional) A mapping of tags to assign to the resource. + +--- + +The `record` block supports: + +- `matching_type` - (Required) Matching Type of the TLSA record. + +- `selector` - (Required) Selector of the TLSA record. + +- `usage` - (Required) Usage of the TLSA record. + +- `certificate_association_data` - (Required) Certificate data to be matched. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +- `id` - The DNS TLSA Record ID. + +- `fqdn` - The FQDN of the DNS TLSA Record. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +- `create` - (Defaults to 30 minutes) Used when creating the DNS TLSA Record. + +- `update` - (Defaults to 30 minutes) Used when updating the DNS TLSA Record. + +- `read` - (Defaults to 5 minutes) Used when retrieving the DNS TLSA Record. + +- `delete` - (Defaults to 30 minutes) Used when deleting the DNS TLSA Record. + +## Import + +TLSA records can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_dns_tlsa_record.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/dnsZones/zone1/TLSA/myrecord1 +```