From 5871090a02e2cd06c79159b36a5ab622f71db2cf Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Mon, 6 Nov 2023 12:32:11 +0100 Subject: [PATCH] dependencies: updating to `v0.63.0` of `github.com/hashicorp/go-azure-helpers` --- go.mod | 2 +- go.sum | 4 +- .../commonids/shared_image_gallery.go | 127 ++++++++++++++++ .../resourcemanager/commonids/sql_database.go | 140 ++++++++++++++++++ .../commonids/sql_elastic_pool.go | 140 ++++++++++++++++++ .../commonids/sql_managed_instance.go | 127 ++++++++++++++++ .../sql_managed_instance_database.go | 140 ++++++++++++++++++ .../resourcemanager/commonids/sql_server.go | 127 ++++++++++++++++ vendor/modules.txt | 2 +- 9 files changed, 805 insertions(+), 4 deletions(-) create mode 100644 vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/shared_image_gallery.go create mode 100644 vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/sql_database.go create mode 100644 vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/sql_elastic_pool.go create mode 100644 vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/sql_managed_instance.go create mode 100644 vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/sql_managed_instance_database.go create mode 100644 vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/sql_server.go diff --git a/go.mod b/go.mod index 1d41b7744f82..7ac94cacf106 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/golang-jwt/jwt/v4 v4.5.0 github.com/google/go-cmp v0.5.9 github.com/google/uuid v1.3.1 - github.com/hashicorp/go-azure-helpers v0.62.0 + github.com/hashicorp/go-azure-helpers v0.63.0 github.com/hashicorp/go-azure-sdk v0.20231025.1113325 github.com/hashicorp/go-hclog v1.5.0 github.com/hashicorp/go-multierror v1.1.1 diff --git a/go.sum b/go.sum index 66114eebec6d..37a2a009aed1 100644 --- a/go.sum +++ b/go.sum @@ -111,8 +111,8 @@ github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg= -github.com/hashicorp/go-azure-helpers v0.62.0 h1:3Ob1yFAO71Pbdnm14HUI4dGZUaO/Nqmncu5cKMGsDBg= -github.com/hashicorp/go-azure-helpers v0.62.0/go.mod h1:ELmZ65vzHJNTk6ml4jsPD+xq2gZb7t78D35s+XN02Kk= +github.com/hashicorp/go-azure-helpers v0.63.0 h1:7bYnYZsqzPjxVevi0z8Irwp5DwS8okLcaA183DQAcmY= +github.com/hashicorp/go-azure-helpers v0.63.0/go.mod h1:ELmZ65vzHJNTk6ml4jsPD+xq2gZb7t78D35s+XN02Kk= github.com/hashicorp/go-azure-sdk v0.20231025.1113325 h1:LS2ZBtyK3cViLw2FQt11jm9YCdHRp2UQpe1pu5SKlZY= github.com/hashicorp/go-azure-sdk v0.20231025.1113325/go.mod h1:3IQjdvuhEckMgdWpvQs4e4VdiiRLIm4z82kO814t/Lw= github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/shared_image_gallery.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/shared_image_gallery.go new file mode 100644 index 000000000000..0c7cc587af47 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/shared_image_gallery.go @@ -0,0 +1,127 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SharedImageGalleryId{} + +// SharedImageGalleryId is a struct representing the Resource ID for a Shared Image Gallery +type SharedImageGalleryId struct { + SubscriptionId string + ResourceGroupName string + GalleryName string +} + +// NewSharedImageGalleryID returns a new sharedImageGalleryId struct +func NewSharedImageGalleryID(subscriptionId string, resourceGroupName string, galleryName string) SharedImageGalleryId { + return SharedImageGalleryId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + GalleryName: galleryName, + } +} + +// ParseSharedImageGalleryID parses 'input' into a sharedImageGalleryId +func ParseSharedImageGalleryID(input string) (*SharedImageGalleryId, error) { + parser := resourceids.NewParserFromResourceIdType(SharedImageGalleryId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SharedImageGalleryId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + } + + return &id, nil +} + +// ParseSharedImageGalleryIDInsensitively parses 'input' case-insensitively into a sharedImageGalleryId +// note: this method should only be used for API response data and not user input +func ParseSharedImageGalleryIDInsensitively(input string) (*SharedImageGalleryId, error) { + parser := resourceids.NewParserFromResourceIdType(SharedImageGalleryId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SharedImageGalleryId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + } + + return &id, nil +} + +// ValidateSharedImageGalleryID validates the ID of a Shared Image Gallery +func ValidateSharedImageGalleryID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected string, got %T", input)) + return + } + + if _, err := ParseSharedImageGalleryID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Shared Image Gallery ID +func (id SharedImageGalleryId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/galleries/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.GalleryName) +} + +// String returns a human-readable description of the Shared Image Gallery ID +func (id SharedImageGalleryId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Gallery Name: %q", id.GalleryName), + } + return fmt.Sprintf("Shared Image Gallery (%s)", strings.Join(components, "\n")) +} + +// Segments returns a slice of Resource ID Segments which comprise this Shared Image Gallery ID +func (id SharedImageGalleryId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticGalleries", "galleries", "galleries"), + resourceids.UserSpecifiedSegment("galleryName", "galleryValue"), + } +} diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/sql_database.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/sql_database.go new file mode 100644 index 000000000000..8be362d36695 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/sql_database.go @@ -0,0 +1,140 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SqlDatabaseId{} + +// SqlDatabaseId is a struct representing the Resource ID for a Sql Database +type SqlDatabaseId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + DatabaseName string +} + +// NewSqlDatabaseID returns a new SqlDatabaseId struct +func NewSqlDatabaseID(subscriptionId string, resourceGroupName string, serverName string, databaseName string) SqlDatabaseId { + return SqlDatabaseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + DatabaseName: databaseName, + } +} + +// ParseDatabaseID parses 'input' into a SqlDatabaseId +func ParseDatabaseID(input string) (*SqlDatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(SqlDatabaseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SqlDatabaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + } + + return &id, nil +} + +// ParseSqlDatabaseIDInsensitively parses 'input' case-insensitively into a SqlDatabaseId +// note: this method should only be used for API response data and not user input +func ParseSqlDatabaseIDInsensitively(input string) (*SqlDatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(SqlDatabaseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SqlDatabaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + } + + return &id, nil +} + +// ValidateSqlDatabaseID checks that 'input' can be parsed as a Sql Database ID +func ValidateSqlDatabaseID(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 := ParseDatabaseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Database ID +func (id SqlDatabaseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Sql/servers/%s/databases/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.DatabaseName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Sql Database ID +func (id SqlDatabaseId) 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("staticMicrosoftSql", "Microsoft.Sql", "Microsoft.Sql"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticDatabases", "databases", "databases"), + resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + } +} + +// String returns a human-readable description of this Sql Database ID +func (id SqlDatabaseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + } + return fmt.Sprintf("Database (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/sql_elastic_pool.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/sql_elastic_pool.go new file mode 100644 index 000000000000..918827a0dcc0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/sql_elastic_pool.go @@ -0,0 +1,140 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SqlElasticPoolId{} + +// SqlElasticPoolId is a struct representing the Resource ID for a Sql SqlElastic Pool +type SqlElasticPoolId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + ElasticPoolName string +} + +// NewSqlElasticPoolID returns a new SqlElasticPoolId struct +func NewSqlElasticPoolID(subscriptionId string, resourceGroupName string, serverName string, elasticPoolName string) SqlElasticPoolId { + return SqlElasticPoolId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + ElasticPoolName: elasticPoolName, + } +} + +// ParseSqlElasticPoolID parses 'input' into a SqlElasticPoolId +func ParseSqlElasticPoolID(input string) (*SqlElasticPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(SqlElasticPoolId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SqlElasticPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + if id.ElasticPoolName, ok = parsed.Parsed["elasticPoolName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticPoolName", *parsed) + } + + return &id, nil +} + +// ParseSqlElasticPoolIDInsensitively parses 'input' case-insensitively into a SqlElasticPoolId +// note: this method should only be used for API response data and not user input +func ParseSqlElasticPoolIDInsensitively(input string) (*SqlElasticPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(SqlElasticPoolId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SqlElasticPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + if id.ElasticPoolName, ok = parsed.Parsed["elasticPoolName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticPoolName", *parsed) + } + + return &id, nil +} + +// ValidateSqlElasticPoolID checks that 'input' can be parsed as a Sql Elastic Pool ID +func ValidateSqlElasticPoolID(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 := ParseSqlElasticPoolID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Sql Elastic Pool ID +func (id SqlElasticPoolId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Sql/servers/%s/elasticPools/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.ElasticPoolName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Sql Elastic Pool ID +func (id SqlElasticPoolId) 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("staticMicrosoftSql", "Microsoft.Sql", "Microsoft.Sql"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticElasticPools", "elasticPools", "elasticPools"), + resourceids.UserSpecifiedSegment("elasticPoolName", "elasticPoolValue"), + } +} + +// String returns a human-readable description of this Sql Elastic Pool ID +func (id SqlElasticPoolId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Elastic Pool Name: %q", id.ElasticPoolName), + } + return fmt.Sprintf("Elastic Pool (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/sql_managed_instance.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/sql_managed_instance.go new file mode 100644 index 000000000000..63f7fc9d448b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/sql_managed_instance.go @@ -0,0 +1,127 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SqlManagedInstanceId{} + +// SqlManagedInstanceId is a struct representing the Resource ID for a Sql Managed Instance +type SqlManagedInstanceId struct { + SubscriptionId string + ResourceGroupName string + ManagedInstanceName string +} + +// NewSqlManagedInstanceID returns a new SqlManagedInstanceId struct +func NewSqlManagedInstanceID(subscriptionId string, resourceGroupName string, managedInstanceName string) SqlManagedInstanceId { + return SqlManagedInstanceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedInstanceName: managedInstanceName, + } +} + +// ParseSqlManagedInstanceID parses 'input' into a SqlManagedInstanceId +func ParseSqlManagedInstanceID(input string) (*SqlManagedInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(SqlManagedInstanceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SqlManagedInstanceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + } + + return &id, nil +} + +// ParseSqlManagedInstanceIDInsensitively parses 'input' case-insensitively into a SqlManagedInstanceId +// note: this method should only be used for API response data and not user input +func ParseSqlManagedInstanceIDInsensitively(input string) (*SqlManagedInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(SqlManagedInstanceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SqlManagedInstanceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + } + + return &id, nil +} + +// ValidateSqlManagedInstanceID checks that 'input' can be parsed as a Sql Managed Instance ID +func ValidateSqlManagedInstanceID(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 := ParseSqlManagedInstanceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Sql Managed Instance ID +func (id SqlManagedInstanceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Sql/managedInstances/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedInstanceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Sql Managed Instance ID +func (id SqlManagedInstanceId) 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("staticMicrosoftSql", "Microsoft.Sql", "Microsoft.Sql"), + resourceids.StaticSegment("staticManagedInstances", "managedInstances", "managedInstances"), + resourceids.UserSpecifiedSegment("managedInstanceName", "managedInstanceValue"), + } +} + +// String returns a human-readable description of this Sql Managed Instance ID +func (id SqlManagedInstanceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Managed Instance Name: %q", id.ManagedInstanceName), + } + return fmt.Sprintf("Managed Instance (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/sql_managed_instance_database.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/sql_managed_instance_database.go new file mode 100644 index 000000000000..2a69fd4395b0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/sql_managed_instance_database.go @@ -0,0 +1,140 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SqlManagedInstanceDatabaseId{} + +// SqlManagedInstanceDatabaseId is a struct representing the Resource ID for a Sql Managed Instance Database +type SqlManagedInstanceDatabaseId struct { + SubscriptionId string + ResourceGroupName string + ManagedInstanceName string + DatabaseName string +} + +// NewSqlManagedInstanceDatabaseID returns a new SqlManagedInstanceDatabaseId struct +func NewSqlManagedInstanceDatabaseID(subscriptionId string, resourceGroupName string, managedInstanceName string, databaseName string) SqlManagedInstanceDatabaseId { + return SqlManagedInstanceDatabaseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedInstanceName: managedInstanceName, + DatabaseName: databaseName, + } +} + +// ParseManagedInstanceDatabaseID parses 'input' into a SqlManagedInstanceDatabaseId +func ParseManagedInstanceDatabaseID(input string) (*SqlManagedInstanceDatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(SqlManagedInstanceDatabaseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SqlManagedInstanceDatabaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + } + + return &id, nil +} + +// ParseSqlManagedInstanceDatabaseIDInsensitively parses 'input' case-insensitively into a SqlManagedInstanceDatabaseId +// note: this method should only be used for API response data and not user input +func ParseSqlManagedInstanceDatabaseIDInsensitively(input string) (*SqlManagedInstanceDatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(SqlManagedInstanceDatabaseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SqlManagedInstanceDatabaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + } + + return &id, nil +} + +// ValidateSqlManagedInstanceDatabaseID checks that 'input' can be parsed as a Sql Managed Instance Database ID +func ValidateSqlManagedInstanceDatabaseID(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 := ParseManagedInstanceDatabaseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Sql Managed Instance Database ID +func (id SqlManagedInstanceDatabaseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Sql/managedInstances/%s/databases/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedInstanceName, id.DatabaseName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Sql Managed Instance Database ID +func (id SqlManagedInstanceDatabaseId) 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("staticMicrosoftSql", "Microsoft.Sql", "Microsoft.Sql"), + resourceids.StaticSegment("staticManagedInstances", "managedInstances", "managedInstances"), + resourceids.UserSpecifiedSegment("managedInstanceName", "managedInstanceValue"), + resourceids.StaticSegment("staticDatabases", "databases", "databases"), + resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + } +} + +// String returns a human-readable description of this Sql Managed Instance Database ID +func (id SqlManagedInstanceDatabaseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Managed Instance Name: %q", id.ManagedInstanceName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + } + return fmt.Sprintf("Managed Instance Database (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/sql_server.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/sql_server.go new file mode 100644 index 000000000000..be7beeab867e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/sql_server.go @@ -0,0 +1,127 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SqlServerId{} + +// SqlServerId is a struct representing the Resource ID for a Sql Server +type SqlServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewSqlServerID returns a new SqlServerId struct +func NewSqlServerID(subscriptionId string, resourceGroupName string, serverName string) SqlServerId { + return SqlServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseSqlServerID parses 'input' into a SqlServerId +func ParseSqlServerID(input string) (*SqlServerId, error) { + parser := resourceids.NewParserFromResourceIdType(SqlServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SqlServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ParseSqlServerIDInsensitively parses 'input' case-insensitively into a SqlServerId +// note: this method should only be used for API response data and not user input +func ParseSqlServerIDInsensitively(input string) (*SqlServerId, error) { + parser := resourceids.NewParserFromResourceIdType(SqlServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SqlServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ValidateSqlServerID checks that 'input' can be parsed as a Sql Server ID +func ValidateSqlServerID(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 := ParseSqlServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Sql Server ID +func (id SqlServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Sql/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Sql Server ID +func (id SqlServerId) 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("staticMicrosoftSql", "Microsoft.Sql", "Microsoft.Sql"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Sql Server ID +func (id SqlServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 98c891cb89b4..dcf8911c5f90 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -139,7 +139,7 @@ github.com/google/uuid # github.com/hashicorp/errwrap v1.1.0 ## explicit github.com/hashicorp/errwrap -# github.com/hashicorp/go-azure-helpers v0.62.0 +# github.com/hashicorp/go-azure-helpers v0.63.0 ## explicit; go 1.21 github.com/hashicorp/go-azure-helpers/authentication github.com/hashicorp/go-azure-helpers/eventhub