From bc92b91e4cbc6e01f8d5f7582cb6489b799a37ab Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Wed, 27 Mar 2024 17:32:05 +0100 Subject: [PATCH] dependencies: updating to `v0.67.0` of `github.com/hashicorp/go-azure-helpers` --- go.mod | 2 +- go.sum | 4 +- .../commonids/billing_account_customer.go | 117 ++++++++++++++++ .../billing_account_invoice_section.go | 126 ++++++++++++++++++ .../commonids/billing_enrollment_account.go | 108 +++++++++++++++ .../commonids/community_gallery_image.go | 115 ++++++++++++++++ .../community_gallery_image_version.go | 124 +++++++++++++++++ .../commonids/composite_resource_id.go | 91 +++++++++++++ .../resourcemanager/commonids/ids.go | 72 ++++++++++ .../commonids/virtual_machine_scale_set.go | 2 + vendor/modules.txt | 2 +- 11 files changed, 759 insertions(+), 4 deletions(-) create mode 100644 vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/billing_account_customer.go create mode 100644 vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/billing_account_invoice_section.go create mode 100644 vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/billing_enrollment_account.go create mode 100644 vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/community_gallery_image.go create mode 100644 vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/community_gallery_image_version.go create mode 100644 vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/composite_resource_id.go create mode 100644 vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/ids.go diff --git a/go.mod b/go.mod index 0c667339fda1..dbd6eb58d4f9 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.4.0 - github.com/hashicorp/go-azure-helpers v0.66.2 + github.com/hashicorp/go-azure-helpers v0.67.0 github.com/hashicorp/go-azure-sdk/resource-manager v0.20240321.1145953 github.com/hashicorp/go-azure-sdk/sdk v0.20240321.1145953 github.com/hashicorp/go-hclog v1.5.0 diff --git a/go.sum b/go.sum index 2de1713a5e16..1cb52769607c 100644 --- a/go.sum +++ b/go.sum @@ -93,8 +93,8 @@ github.com/hashicorp/errwrap v0.0.0-20180715044906-d6c0cd880357/go.mod h1:YH+1FK github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= 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.66.2 h1:+Pzuo7pdKl0hBXXr5ymmhs4Q40tHAo2nAvHq4WgSjx8= -github.com/hashicorp/go-azure-helpers v0.66.2/go.mod h1:kJxXrFtJKJdOEqvad8pllAe7dhP4DbN8J6sqFZe47+4= +github.com/hashicorp/go-azure-helpers v0.67.0 h1:0RY6mY3W3Ym2I+jExLtyLx96fh6p5n9vidqisAKGUSE= +github.com/hashicorp/go-azure-helpers v0.67.0/go.mod h1:S4Bu66vyJvHA0trqHQB0YVGsISuF7HMH9tyEsMVlx8A= github.com/hashicorp/go-azure-sdk/resource-manager v0.20240321.1145953 h1:eoU9iMmWgufB441trZJ45TsZ+0vJ79vGKdBuVVYUXwI= github.com/hashicorp/go-azure-sdk/resource-manager v0.20240321.1145953/go.mod h1:zvsDltRIRr58vA0EpSmY+a6NcgGirQE/u02Ag+D8jmM= github.com/hashicorp/go-azure-sdk/sdk v0.20240321.1145953 h1:WAcSZL5+H9Z/DjUZ0x0sluNoEno/mD4b+NWpY04vJrw= diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/billing_account_customer.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/billing_account_customer.go new file mode 100644 index 000000000000..90bfdfc16506 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/billing_account_customer.go @@ -0,0 +1,117 @@ +// 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 = &BillingAccountCustomerId{} + +// BillingAccountCustomerId is a struct representing the Resource ID for a Billing Account Customer +type BillingAccountCustomerId struct { + BillingAccountName string + CustomerName string +} + +// NewBillingAccountCustomerID returns a new BillingAccountCustomerId struct +func NewBillingAccountCustomerID(billingAccountName string, customerName string) BillingAccountCustomerId { + return BillingAccountCustomerId{ + BillingAccountName: billingAccountName, + CustomerName: customerName, + } +} + +// ParseBillingAccountCustomerID parses 'input' into a BillingAccountCustomerId +func ParseBillingAccountCustomerID(input string) (*BillingAccountCustomerId, error) { + parser := resourceids.NewParserFromResourceIdType(&BillingAccountCustomerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BillingAccountCustomerId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseBillingAccountCustomerIDInsensitively parses 'input' case-insensitively into a BillingAccountCustomerId +// note: this method should only be used for API response data and not user input +func ParseBillingAccountCustomerIDInsensitively(input string) (*BillingAccountCustomerId, error) { + parser := resourceids.NewParserFromResourceIdType(&BillingAccountCustomerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BillingAccountCustomerId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BillingAccountCustomerId) FromParseResult(input resourceids.ParseResult) error { + + var ok bool + + if id.BillingAccountName, ok = input.Parsed["billingAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountName", input) + } + + if id.CustomerName, ok = input.Parsed["customerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customerName", input) + } + + return nil +} + +// ValidateBillingAccountCustomerID checks that 'input' can be parsed as a Billing Account Customer ID +func ValidateBillingAccountCustomerID(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 := ParseBillingAccountCustomerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Billing Account Customer ID +func (id BillingAccountCustomerId) ID() string { + fmtString := "/providers/Microsoft.Billing/billingAccounts/%s/customers/%s" + return fmt.Sprintf(fmtString, id.BillingAccountName, id.CustomerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Billing Account Customer ID +func (id BillingAccountCustomerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("providers", "providers", "providers"), + resourceids.ResourceProviderSegment("resourceProvider", "Microsoft.Billing", "Microsoft.Billing"), + resourceids.StaticSegment("billingAccounts", "billingAccounts", "billingAccounts"), + resourceids.UserSpecifiedSegment("billingAccountName", "billingAccountValue"), + resourceids.StaticSegment("customers", "customers", "customers"), + resourceids.UserSpecifiedSegment("customerName", "customerValue"), + } +} + +// String returns a human-readable description of this Billing Account Customer ID +func (id BillingAccountCustomerId) String() string { + components := []string{ + fmt.Sprintf("Billing Account Name: %q", id.BillingAccountName), + fmt.Sprintf("Customer Name: %q", id.CustomerName), + } + return fmt.Sprintf("Billing Account Customer (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/billing_account_invoice_section.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/billing_account_invoice_section.go new file mode 100644 index 000000000000..5111e4cb2173 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/billing_account_invoice_section.go @@ -0,0 +1,126 @@ +// 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 = &BillingAccountInvoiceSectionId{} + +// BillingAccountInvoiceSectionId is a struct representing the Resource ID for a Billing Account Invoice Section +type BillingAccountInvoiceSectionId struct { + BillingAccountName string + BillingProfileName string + InvoiceSectionName string +} + +// NewBillingAccountInvoiceSectionID returns a new BillingAccountInvoiceSectionId struct +func NewBillingAccountInvoiceSectionID(billingAccountName string, billingProfileName string, invoiceSectionName string) BillingAccountInvoiceSectionId { + return BillingAccountInvoiceSectionId{ + BillingAccountName: billingAccountName, + BillingProfileName: billingProfileName, + InvoiceSectionName: invoiceSectionName, + } +} + +// ParseBillingAccountInvoiceSectionID parses 'input' into a BillingAccountInvoiceSectionId +func ParseBillingAccountInvoiceSectionID(input string) (*BillingAccountInvoiceSectionId, error) { + parser := resourceids.NewParserFromResourceIdType(&BillingAccountInvoiceSectionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BillingAccountInvoiceSectionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseBillingAccountInvoiceSectionIDInsensitively parses 'input' case-insensitively into a BillingAccountInvoiceSectionId +// note: this method should only be used for API response data and not user input +func ParseBillingAccountInvoiceSectionIDInsensitively(input string) (*BillingAccountInvoiceSectionId, error) { + parser := resourceids.NewParserFromResourceIdType(&BillingAccountInvoiceSectionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BillingAccountInvoiceSectionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BillingAccountInvoiceSectionId) FromParseResult(input resourceids.ParseResult) error { + + var ok bool + + if id.BillingAccountName, ok = input.Parsed["billingAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountName", input) + } + + if id.BillingProfileName, ok = input.Parsed["billingProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileName", input) + } + + if id.InvoiceSectionName, ok = input.Parsed["invoiceSectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "invoiceSectionName", input) + } + + return nil +} + +// ValidateBillingAccountInvoiceSectionID checks that 'input' can be parsed as a Billing Account Invoice Section ID +func ValidateBillingAccountInvoiceSectionID(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 := ParseBillingAccountInvoiceSectionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Billing Account Invoice Section ID +func (id BillingAccountInvoiceSectionId) ID() string { + fmtString := "/providers/Microsoft.Billing/billingAccounts/%s/billingProfiles/%s/invoiceSections/%s" + return fmt.Sprintf(fmtString, id.BillingAccountName, id.BillingProfileName, id.InvoiceSectionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Billing Account Invoice Section ID +func (id BillingAccountInvoiceSectionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("providers", "providers", "providers"), + resourceids.ResourceProviderSegment("resourceProvider", "Microsoft.Billing", "Microsoft.Billing"), + resourceids.StaticSegment("billingAccounts", "billingAccounts", "billingAccounts"), + resourceids.UserSpecifiedSegment("billingAccountName", "billingAccountValue"), + resourceids.StaticSegment("billingProfiles", "billingProfiles", "billingProfiles"), + resourceids.UserSpecifiedSegment("billingProfileName", "billingProfileValue"), + resourceids.StaticSegment("invoiceSections", "invoiceSections", "invoiceSections"), + resourceids.UserSpecifiedSegment("invoiceSectionName", "invoiceSectionValue"), + } +} + +// String returns a human-readable description of this Billing Account Invoice Section ID +func (id BillingAccountInvoiceSectionId) String() string { + components := []string{ + fmt.Sprintf("Billing Account Name: %q", id.BillingAccountName), + fmt.Sprintf("Billing Profile Name: %q", id.BillingProfileName), + fmt.Sprintf("Invoice Section Name: %q", id.InvoiceSectionName), + } + return fmt.Sprintf("Billing Account Invoice Section (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/billing_enrollment_account.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/billing_enrollment_account.go new file mode 100644 index 000000000000..1e51a1d0c2f8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/billing_enrollment_account.go @@ -0,0 +1,108 @@ +// 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 = &BillingEnrollmentAccountId{} + +// BillingEnrollmentAccountId is a struct representing the Resource ID for a Billing Enrollment Account +type BillingEnrollmentAccountId struct { + EnrollmentAccountName string +} + +// NewBillingEnrollmentAccountID returns a new BillingEnrollmentAccountId struct +func NewBillingEnrollmentAccountID(enrollmentAccountName string) BillingEnrollmentAccountId { + return BillingEnrollmentAccountId{ + EnrollmentAccountName: enrollmentAccountName, + } +} + +// ParseBillingEnrollmentAccountID parses 'input' into a BillingEnrollmentAccountId +func ParseBillingEnrollmentAccountID(input string) (*BillingEnrollmentAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(&BillingEnrollmentAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BillingEnrollmentAccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseBillingEnrollmentAccountIDInsensitively parses 'input' case-insensitively into a BillingEnrollmentAccountId +// note: this method should only be used for API response data and not user input +func ParseBillingEnrollmentAccountIDInsensitively(input string) (*BillingEnrollmentAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(&BillingEnrollmentAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BillingEnrollmentAccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BillingEnrollmentAccountId) FromParseResult(input resourceids.ParseResult) error { + + var ok bool + + if id.EnrollmentAccountName, ok = input.Parsed["enrollmentAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "enrollmentAccountName", input) + } + + return nil +} + +// ValidateBillingEnrollmentAccountID checks that 'input' can be parsed as a Billing Enrollment Account ID +func ValidateBillingEnrollmentAccountID(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 := ParseBillingEnrollmentAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Billing Enrollment Account ID +func (id BillingEnrollmentAccountId) ID() string { + fmtString := "/providers/Microsoft.Billing/enrollmentAccounts/%s" + return fmt.Sprintf(fmtString, id.EnrollmentAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Billing Enrollment Account ID +func (id BillingEnrollmentAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("providers", "providers", "providers"), + resourceids.ResourceProviderSegment("resourceProvider", "Microsoft.Billing", "Microsoft.Billing"), + resourceids.StaticSegment("enrollmentAccounts", "enrollmentAccounts", "enrollmentAccounts"), + resourceids.UserSpecifiedSegment("enrollmentAccountName", "enrollmentAccountValue"), + } +} + +// String returns a human-readable description of this Billing Enrollment Account ID +func (id BillingEnrollmentAccountId) String() string { + components := []string{ + fmt.Sprintf("Enrollment Account Name: %q", id.EnrollmentAccountName), + } + return fmt.Sprintf("Billing Enrollment Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/community_gallery_image.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/community_gallery_image.go new file mode 100644 index 000000000000..7e01196fc7dd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/community_gallery_image.go @@ -0,0 +1,115 @@ +// 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 = &CommunityGalleryImageId{} + +// CommunityGalleryImageId is a struct representing the Resource ID for a Community Gallery Image +type CommunityGalleryImageId struct { + CommunityGalleryName string + ImageName string +} + +// NewCommunityGalleryImageID returns a new CommunityGalleryImageId struct +func NewCommunityGalleryImageID(communityGallery string, image string) CommunityGalleryImageId { + return CommunityGalleryImageId{ + CommunityGalleryName: communityGallery, + ImageName: image, + } +} + +// ParseCommunityGalleryImageID parses 'input' into a CommunityGalleryImageId +func ParseCommunityGalleryImageID(input string) (*CommunityGalleryImageId, error) { + parser := resourceids.NewParserFromResourceIdType(&CommunityGalleryImageId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CommunityGalleryImageId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCommunityGalleryImageIDInsensitively parses 'input' case-insensitively into a CommunityGalleryImageId +// note: this method should only be used for API response data and not user input +func ParseCommunityGalleryImageIDInsensitively(input string) (*CommunityGalleryImageId, error) { + parser := resourceids.NewParserFromResourceIdType(&CommunityGalleryImageId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CommunityGalleryImageId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CommunityGalleryImageId) FromParseResult(input resourceids.ParseResult) error { + + var ok bool + + if id.CommunityGalleryName, ok = input.Parsed["communityGalleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", input) + } + + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) + } + + return nil +} + +// ValidateCommunityGalleryImageID checks that 'input' can be parsed as a Community Gallery Image ID +func ValidateCommunityGalleryImageID(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 := ParseCommunityGalleryImageID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Community Gallery Image ID +func (id CommunityGalleryImageId) ID() string { + fmtString := "/communityGalleries/%s/images/%s" + return fmt.Sprintf(fmtString, id.CommunityGalleryName, id.ImageName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Community Gallery Image ID +func (id CommunityGalleryImageId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticCommunityGalleries", "communityGalleries", "communityGalleries"), + resourceids.UserSpecifiedSegment("communityGalleryName", "communityGalleryValue"), + resourceids.StaticSegment("staticImages", "images", "images"), + resourceids.UserSpecifiedSegment("imageName", "imageValue"), + } +} + +// String returns a human-readable description of this Community Gallery Image ID +func (id CommunityGalleryImageId) String() string { + components := []string{ + fmt.Sprintf("Community Gallery Name: %q", id.CommunityGalleryName), + fmt.Sprintf("Image Name: %q", id.ImageName), + } + return fmt.Sprintf("Community Gallery Image (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/community_gallery_image_version.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/community_gallery_image_version.go new file mode 100644 index 000000000000..8a408a07e046 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/community_gallery_image_version.go @@ -0,0 +1,124 @@ +// 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 = &CommunityGalleryImageVersionId{} + +// CommunityGalleryImageVersionId is a struct representing the Resource ID for a Community Gallery Image Version +type CommunityGalleryImageVersionId struct { + CommunityGalleryName string + ImageName string + VersionName string +} + +// NewCommunityGalleryImageVersionID returns a new CommunityGalleryImageVersionId struct +func NewCommunityGalleryImageVersionID(communityGallery string, image string, version string) CommunityGalleryImageVersionId { + return CommunityGalleryImageVersionId{ + CommunityGalleryName: communityGallery, + ImageName: image, + VersionName: version, + } +} + +// ParseCommunityGalleryImageVersionID parses 'input' into a CommunityGalleryImageVersionId +func ParseCommunityGalleryImageVersionID(input string) (*CommunityGalleryImageVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&CommunityGalleryImageVersionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CommunityGalleryImageVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCommunityGalleryImageVersionIDInsensitively parses 'input' case-insensitively into a CommunityGalleryImageVersionId +// note: this method should only be used for API response data and not user input +func ParseCommunityGalleryImageVersionIDInsensitively(input string) (*CommunityGalleryImageVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&CommunityGalleryImageVersionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CommunityGalleryImageVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CommunityGalleryImageVersionId) FromParseResult(input resourceids.ParseResult) error { + + var ok bool + + if id.CommunityGalleryName, ok = input.Parsed["communityGalleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", input) + } + + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) + } + + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) + } + + return nil +} + +// ValidateCommunityGalleryImageVersionID checks that 'input' can be parsed as a Community Gallery Image Version ID +func ValidateCommunityGalleryImageVersionID(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 := ParseCommunityGalleryImageVersionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Community Gallery Image Version ID +func (id CommunityGalleryImageVersionId) ID() string { + fmtString := "/communityGalleries/%s/images/%s/versions/%s" + return fmt.Sprintf(fmtString, id.CommunityGalleryName, id.ImageName, id.VersionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Community Gallery Image Version ID +func (id CommunityGalleryImageVersionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticCommunityGalleries", "communityGalleries", "communityGalleries"), + resourceids.UserSpecifiedSegment("communityGalleryName", "communityGalleryValue"), + resourceids.StaticSegment("staticImages", "images", "images"), + resourceids.UserSpecifiedSegment("imageName", "imageValue"), + resourceids.StaticSegment("staticVersions", "versions", "versions"), + resourceids.UserSpecifiedSegment("versionName", "versionValue"), + } +} + +// String returns a human-readable description of this Community Gallery Image Version ID +func (id CommunityGalleryImageVersionId) String() string { + components := []string{ + fmt.Sprintf("Community Gallery Name: %q", id.CommunityGalleryName), + fmt.Sprintf("Image Name: %q", id.ImageName), + fmt.Sprintf("Version Name: %q", id.VersionName), + } + return fmt.Sprintf("Community Gallery Image Version (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/composite_resource_id.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/composite_resource_id.go new file mode 100644 index 000000000000..0038ed03ca85 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/composite_resource_id.go @@ -0,0 +1,91 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// CompositeResourceID is a struct representing the Resource ID for a Composite Resource Id +type CompositeResourceID[T1 resourceids.ResourceId, T2 resourceids.ResourceId] struct { + // First specifies the first component of this Resource ID. + // This is in the format `{first}|{second}`. + First T1 + + // Second specifies the second component of this Resource ID + // This is in the format `{first}|{second}`. + Second T2 +} + +// ID returns the formatted Composite Resource Id +func (id CompositeResourceID[T1, T2]) ID() string { + fmtString := "%s|%s" + return fmt.Sprintf(fmtString, id.First.ID(), id.Second.ID()) +} + +// String returns a human-readable description of this Composite Resource Id +func (id CompositeResourceID[T1, T2]) String() string { + fmtString := "Composite Resource ID (%s | %s)" + return fmt.Sprintf(fmtString, id.First.String(), id.Second.String()) +} + +// ParseCompositeResourceID parses 'input' and two ResourceIds (first,second) into a CompositeResourceID +// The 'input' should be a string containing 2 resource ids separated by "|" +// eg: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group|/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Sql/servers/serverValue" +// The first and second ResourceIds should match the types in the 'input' string in the order in which they appear +// eg: +// +// input := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group|/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Sql/servers/serverValue" +// first := ResourceGroupId{} +// second := SqlServerId{} +// id, err := ParseCompositeResourceID(input, &first, &second) +func ParseCompositeResourceID[T1 resourceids.ResourceId, T2 resourceids.ResourceId](input string, first T1, second T2) (*CompositeResourceID[T1, T2], error) { + return parseCompositeResourceID(input, first, second, false) +} + +// ParseCompositeResourceIDInsensitively parses 'input' and two ResourceIds (first,second) case-insensitively into a CompositeResourceID +// note: this method should only be used for API response data and not user input +func ParseCompositeResourceIDInsensitively[T1 resourceids.ResourceId, T2 resourceids.ResourceId](input string, first T1, second T2) (*CompositeResourceID[T1, T2], error) { + return parseCompositeResourceID(input, first, second, true) +} + +func parseCompositeResourceID[T1 resourceids.ResourceId, T2 resourceids.ResourceId](input string, first T1, second T2, insensitively bool) (*CompositeResourceID[T1, T2], error) { + + components := strings.Split(input, "|") + if len(components) != 2 { + return nil, fmt.Errorf("expected 2 resourceids but got %d", len(components)) + } + + output := CompositeResourceID[T1, T2]{ + First: first, + Second: second, + } + + // Parse the first of the two Resource IDs from the components + firstParser := resourceids.NewParserFromResourceIdType(output.First) + firstParseResult, err := firstParser.Parse(components[0], insensitively) + if err != nil { + return nil, fmt.Errorf("parsing first id part %q of CompositeResourceID: %v", components[0], err) + } + err = output.First.FromParseResult(*firstParseResult) + if err != nil { + return nil, fmt.Errorf("populating first id part %q of CompositeResourceID: %v", components[0], err) + } + + // Parse the second of the two Resource IDs from the components + secondParser := resourceids.NewParserFromResourceIdType(output.Second) + secondParseResult, err := secondParser.Parse(components[1], insensitively) + if err != nil { + return nil, fmt.Errorf("parsing second id part %q of CompositeResourceID: %v", components[1], err) + } + err = output.Second.FromParseResult(*secondParseResult) + if err != nil { + return nil, fmt.Errorf("populating second id part %q of CompositeResourceID: %v", components[1], err) + } + + return &output, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/ids.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/ids.go new file mode 100644 index 000000000000..0231d66547f9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/ids.go @@ -0,0 +1,72 @@ +package commonids + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +func CommonIds() []resourceids.ResourceId { + + return []resourceids.ResourceId{ + &AppServiceId{}, + &AppServiceEnvironmentId{}, + &AppServicePlanId{}, + &AutomationCompilationJobId{}, + &AvailabilitySetId{}, + &BotServiceId{}, + &BotServiceChannelId{}, + &ChaosStudioCapabilityId{}, + &ChaosStudioTargetId{}, + &CloudServicesIPConfigurationId{}, + &CloudServicesPublicIPAddressId{}, + &DedicatedHostId{}, + &DedicatedHostGroupId{}, + &DevCenterId{}, + &DiskEncryptionSetId{}, + &ExpressRouteCircuitPeeringId{}, + &HDInsightClusterId{}, + &HyperVSiteJobId{}, + &HyperVSiteMachineId{}, + &HyperVSiteRunAsAccountId{}, + &KeyVaultId{}, + &KeyVaultKeyId{}, + &KeyVaultKeyVersionId{}, + &KeyVaultPrivateEndpointConnectionId{}, + &KubernetesClusterId{}, + &KubernetesFleetId{}, + &KustoClusterId{}, + &KustoDatabaseId{}, + &ManagedDiskId{}, + &ManagementGroupId{}, + &NetworkInterfaceId{}, + &NetworkInterfaceIPConfigurationId{}, + &NetworkInterfaceId{}, + &ProvisioningServiceId{}, + &PublicIPAddressId{}, + &ResourceGroupId{}, + &SharedImageGalleryId{}, + &SpringCloudServiceId{}, + &SqlDatabaseId{}, + &SqlElasticPoolId{}, + &SqlManagedInstanceId{}, + &SqlManagedInstanceDatabaseId{}, + &SqlServerId{}, + &StorageAccountId{}, + &StorageContainerId{}, + &SubnetId{}, + &SubscriptionId{}, + &UserAssignedIdentityId{}, + &VirtualHubBGPConnectionId{}, + &VirtualHubIPConfigurationId{}, + &VirtualMachineId{}, + &VirtualMachineScaleSetNetworkInterfaceId{}, + &VirtualMachineScaleSetPublicIPAddressId{}, + &VirtualMachineScaleSetId{}, + &VirtualNetworkId{}, + &VirtualRouterPeeringId{}, + &VirtualWANP2SVPNGatewayId{}, + &VMwareSiteJobId{}, + &VMwareSiteMachineId{}, + &VMwareSiteRunAsAccountId{}, + &VPNConnectionId{}, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set.go index 392d6689a6a3..35f52007afb0 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set.go @@ -10,6 +10,8 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" ) +var _ resourceids.ResourceId = &VirtualMachineScaleSetId{} + // VirtualMachineScaleSetId is a struct representing the Resource ID for a Virtual Machine Scale Set type VirtualMachineScaleSetId struct { SubscriptionId string diff --git a/vendor/modules.txt b/vendor/modules.txt index 09a39768e331..4f3cecee7895 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -132,7 +132,7 @@ github.com/google/uuid # github.com/hashicorp/errwrap v1.1.0 ## explicit github.com/hashicorp/errwrap -# github.com/hashicorp/go-azure-helpers v0.66.2 +# github.com/hashicorp/go-azure-helpers v0.67.0 ## explicit; go 1.21 github.com/hashicorp/go-azure-helpers/authentication github.com/hashicorp/go-azure-helpers/eventhub