From 4914b8d4ed0947f7ee9c2b359e45c3dc824b2957 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Mon, 16 Oct 2023 17:20:11 +0200 Subject: [PATCH] dependencies: updating to `v0.62.0` of `github.com/hashicorp/go-azure-helpers` --- go.mod | 2 +- go.sum | 4 +- .../commonids/kusto_cluster.go | 127 ++++++++++++++++ .../commonids/kusto_database.go | 140 ++++++++++++++++++ vendor/modules.txt | 4 +- 5 files changed, 272 insertions(+), 5 deletions(-) create mode 100644 vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/kusto_cluster.go create mode 100644 vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/kusto_database.go diff --git a/go.mod b/go.mod index a633ef3a910a..fb50325b8f14 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,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.61.0 + github.com/hashicorp/go-azure-helpers v0.62.0 github.com/hashicorp/go-azure-sdk v0.20231012.1141427 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 8f462eeb636b..d98f80fd94d3 100644 --- a/go.sum +++ b/go.sum @@ -108,8 +108,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.61.0 h1:dIz23Vp8LdErxuImc6V5QIPtJcWjMgqP75bfp8o1Lro= -github.com/hashicorp/go-azure-helpers v0.61.0/go.mod h1:BQUQp5udwbJ8pnzl0wByCLVEEyPMAFpJ9vOREiCzObo= +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-sdk v0.20231012.1141427 h1:WIHCXq+w/hWuv4BX4PuXgtoIMQRzSocW4466eD+oz24= github.com/hashicorp/go-azure-sdk v0.20231012.1141427/go.mod h1:n7/QljZviQP/bQF/L1SmkcEgt4KGujaOhQVQpzONW1o= github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/kusto_cluster.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/kusto_cluster.go new file mode 100644 index 000000000000..a653235e3a25 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/kusto_cluster.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 = KustoClusterId{} + +// KustoClusterId is a struct representing the Resource ID for a Kusto Cluster +type KustoClusterId struct { + SubscriptionId string + ResourceGroupName string + KustoClusterName string +} + +// NewKustoClusterID returns a new KustoClusterId struct +func NewKustoClusterID(subscriptionId string, resourceGroupName string, kustoClusterName string) KustoClusterId { + return KustoClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + KustoClusterName: kustoClusterName, + } +} + +// ParseKustoClusterID parses 'input' into a KustoClusterId +func ParseKustoClusterID(input string) (*KustoClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(KustoClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := KustoClusterId{} + + 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.KustoClusterName, ok = parsed.Parsed["kustoClusterName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "kustoClusterName", *parsed) + } + + return &id, nil +} + +// ParseKustoClusterIDInsensitively parses 'input' case-insensitively into a KustoClusterId +// note: this method should only be used for API response data and not user input +func ParseKustoClusterIDInsensitively(input string) (*KustoClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(KustoClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := KustoClusterId{} + + 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.KustoClusterName, ok = parsed.Parsed["kustoClusterName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "kustoClusterName", *parsed) + } + + return &id, nil +} + +// ValidateKustoClusterID checks that 'input' can be parsed as a Kusto Cluster ID +func ValidateKustoClusterID(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 := ParseKustoClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Kusto Cluster ID +func (id KustoClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kusto/clusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.KustoClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Kusto Cluster ID +func (id KustoClusterId) 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("staticMicrosoftKusto", "Microsoft.Kusto", "Microsoft.Kusto"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("kustoClusterName", "clusterValue"), + } +} + +// String returns a human-readable description of this Kusto Cluster ID +func (id KustoClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Kusto Cluster Name: %q", id.KustoClusterName), + } + return fmt.Sprintf("Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/kusto_database.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/kusto_database.go new file mode 100644 index 000000000000..b5ba65fc2231 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/kusto_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 = KustoDatabaseId{} + +// KustoDatabaseId is a struct representing the Resource ID for a Kusto Database +type KustoDatabaseId struct { + SubscriptionId string + ResourceGroupName string + KustoClusterName string + KustoDatabaseName string +} + +// NewKustoDatabaseID returns a new KustoDatabaseId struct +func NewKustoDatabaseID(subscriptionId string, resourceGroupName string, kustoClusterName string, kustoDatabaseName string) KustoDatabaseId { + return KustoDatabaseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + KustoClusterName: kustoClusterName, + KustoDatabaseName: kustoDatabaseName, + } +} + +// ParseKustoDatabaseID parses 'input' into a KustoDatabaseId +func ParseKustoDatabaseID(input string) (*KustoDatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(KustoDatabaseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := KustoDatabaseId{} + + 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.KustoClusterName, ok = parsed.Parsed["kustoClusterName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "kustoClusterName", *parsed) + } + + if id.KustoDatabaseName, ok = parsed.Parsed["kustoDatabaseName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "kustoDatabaseName", *parsed) + } + + return &id, nil +} + +// ParseKustoDatabaseIDInsensitively parses 'input' case-insensitively into a KustoDatabaseId +// note: this method should only be used for API response data and not user input +func ParseKustoDatabaseIDInsensitively(input string) (*KustoDatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(KustoDatabaseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := KustoDatabaseId{} + + 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.KustoClusterName, ok = parsed.Parsed["kustoClusterName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "kustoClusterName", *parsed) + } + + if id.KustoDatabaseName, ok = parsed.Parsed["kustoDatabaseName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "kustoDatabaseName", *parsed) + } + + return &id, nil +} + +// ValidateKustoDatabaseID checks that 'input' can be parsed as a KustoDatabase ID +func ValidateKustoDatabaseID(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 := ParseKustoDatabaseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Kusto Database ID +func (id KustoDatabaseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kusto/clusters/%s/databases/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.KustoClusterName, id.KustoDatabaseName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Kusto Database ID +func (id KustoDatabaseId) 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("staticMicrosoftKusto", "Microsoft.Kusto", "Microsoft.Kusto"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("kustoClusterName", "clusterValue"), + resourceids.StaticSegment("staticDatabases", "databases", "databases"), + resourceids.UserSpecifiedSegment("kustoDatabaseName", "databaseValue"), + } +} + +// String returns a human-readable description of this Kusto Database ID +func (id KustoDatabaseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Kusto Cluster Name: %q", id.KustoClusterName), + fmt.Sprintf("Kusto Database Name: %q", id.KustoDatabaseName), + } + return fmt.Sprintf("Kusto Database (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index a15d1d5070f0..27a7bf419e23 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -135,8 +135,8 @@ github.com/google/uuid # github.com/hashicorp/errwrap v1.1.0 ## explicit github.com/hashicorp/errwrap -# github.com/hashicorp/go-azure-helpers v0.61.0 -## explicit; go 1.19 +# github.com/hashicorp/go-azure-helpers v0.62.0 +## explicit; go 1.21 github.com/hashicorp/go-azure-helpers/authentication github.com/hashicorp/go-azure-helpers/eventhub github.com/hashicorp/go-azure-helpers/lang/dates