Skip to content

Commit

Permalink
dependencies Update digitaltwins api version to 2020-12-01 (#16044)
Browse files Browse the repository at this point in the history
* `dependencies` Update `digitaltwins` api version to 2020-12-01

* Add new required property authenticationType with keyBased

* Change update to set future due to new api update

* Update error message

Co-authored-by: catriona-m <[email protected]>

Co-authored-by: catriona-m <[email protected]>
  • Loading branch information
myc2h6o and catriona-m authored Mar 30, 2022
1 parent 0442ba1 commit eedcc0b
Show file tree
Hide file tree
Showing 17 changed files with 1,184 additions and 67 deletions.
2 changes: 1 addition & 1 deletion internal/services/digitaltwins/client/client.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package client

import (
"github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-10-31/digitaltwins"
"github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"time"

"github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-10-31/digitaltwins"
"github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/parse"
Expand Down Expand Up @@ -105,11 +105,12 @@ func resourceDigitalTwinsEndpointEventGridCreateUpdate(d *pluginsdk.ResourceData

properties := digitaltwins.EndpointResource{
Properties: &digitaltwins.EventGrid{
EndpointType: digitaltwins.EndpointTypeEventGrid,
TopicEndpoint: utils.String(d.Get("eventgrid_topic_endpoint").(string)),
AccessKey1: utils.String(d.Get("eventgrid_topic_primary_access_key").(string)),
AccessKey2: utils.String(d.Get("eventgrid_topic_secondary_access_key").(string)),
DeadLetterSecret: utils.String(d.Get("dead_letter_storage_secret").(string)),
EndpointType: digitaltwins.EndpointTypeEventGrid,
AuthenticationType: digitaltwins.KeyBased,
TopicEndpoint: utils.String(d.Get("eventgrid_topic_endpoint").(string)),
AccessKey1: utils.String(d.Get("eventgrid_topic_primary_access_key").(string)),
AccessKey2: utils.String(d.Get("eventgrid_topic_secondary_access_key").(string)),
DeadLetterSecret: utils.String(d.Get("dead_letter_storage_secret").(string)),
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"time"

"github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-10-31/digitaltwins"
"github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/parse"
Expand Down Expand Up @@ -103,6 +103,7 @@ func resourceDigitalTwinsEndpointEventHubCreateUpdate(d *pluginsdk.ResourceData,
properties := digitaltwins.EndpointResource{
Properties: &digitaltwins.EventHub{
EndpointType: digitaltwins.EndpointTypeEventHub,
AuthenticationType: digitaltwins.KeyBased,
ConnectionStringPrimaryKey: utils.String(d.Get("eventhub_primary_connection_string").(string)),
ConnectionStringSecondaryKey: utils.String(d.Get("eventhub_secondary_connection_string").(string)),
DeadLetterSecret: utils.String(d.Get("dead_letter_storage_secret").(string)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"time"

"github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-10-31/digitaltwins"
"github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/parse"
Expand Down Expand Up @@ -103,6 +103,7 @@ func resourceDigitalTwinsEndpointServiceBusCreateUpdate(d *pluginsdk.ResourceDat
properties := digitaltwins.EndpointResource{
Properties: &digitaltwins.ServiceBus{
EndpointType: digitaltwins.EndpointTypeServiceBus,
AuthenticationType: digitaltwins.KeyBased,
PrimaryConnectionString: utils.String(d.Get("servicebus_primary_connection_string").(string)),
SecondaryConnectionString: utils.String(d.Get("servicebus_secondary_connection_string").(string)),
DeadLetterSecret: utils.String(d.Get("dead_letter_storage_secret").(string)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"time"

"github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-10-31/digitaltwins"
"github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
Expand Down Expand Up @@ -149,8 +149,13 @@ func resourceDigitalTwinsInstanceUpdate(d *pluginsdk.ResourceData, meta interfac
props.Tags = tags.Expand(d.Get("tags").(map[string]interface{}))
}

if _, err := client.Update(ctx, id.ResourceGroup, id.Name, props); err != nil {
return fmt.Errorf("updating Digital Twins Instance %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err)
future, err := client.Update(ctx, id.ResourceGroup, id.Name, props)
if err != nil {
return fmt.Errorf("updating %s: %+v", *id, err)
}

if err := future.WaitForCompletionRef(ctx, client.Client); err != nil {
return fmt.Errorf("waiting for update of %s: %+v", *id, err)
}

return resourceDigitalTwinsInstanceRead(d, meta)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit eedcc0b

Please sign in to comment.